Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task
agodefroyLeni opened this issue Apr 15, 2024 · 2 comments
Open
1 task

Comments

@agodefroyLeni
Copy link

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

@daffl
Copy link
Member

daffl commented Apr 17, 2024

Are you using Express or Koa? What did it return before?

@agodefroyLeni
Copy link
Author

Are you using Express or Koa? What did it return before?

I'm using express.
It used tu return a 200 code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants