Skip to content

Calls to feathers services with HEAD method are throwing an error since v5.x. #3464

Description

@agodefroyLeni

Hello,

Steps to reproduce

Create a simple service :

info.service.js

import Info from './info.class';
import hooks from './info.hooks';

export default function (app) {

  app.use(
    '/v1/info',
    new Info({}, app)
  );

  const service = app.service('/v1/info');
  service.hooks(hooks);
}

info.class.js :

import { MethodNotAllowed } from '@feathersjs/errors';
import fse from 'fs-extra';

class Info {
  async setup(app) {
    this.app = app;
  }

  async find() {
    const { version } = await fse.readJson('./package-lock.json');
    return { version };
  }

  async get()
  {
    throw new MethodNotAllowed();
  }
}

export default Info;
  • Since I recently updated feathers to v5.x, calls to a service with HEAD method are throwing an error (500).
    curl --location --head 'http://localhost:12030/api/v1/info'

Expected behavior

To return a 200 code.

Actual behavior

Throwing a 500 error.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working): 5.0.21

NodeJS version: 20.11.1

Operating System: Ubuntu 22.04.3

Module Loader: commonJs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions