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

Add test for unknown method #883

Merged
merged 2 commits into from Apr 21, 2018
Merged

Add test for unknown method #883

merged 2 commits into from Apr 21, 2018

Conversation

allevo
Copy link
Member

@allevo allevo commented Apr 14, 2018

Add test for checking how fastify handles the unknown http methods

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows Code of conduct

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nwoltman
Copy link
Contributor

It may be useful to add a similar test using http2 since unknown methods are handled differently by the http2 module (it doesn't cause a client error).

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something here, why inject is returning a 404 while simple-get a 400?

@allevo
Copy link
Member Author

allevo commented Apr 15, 2018

Maybe I'm missing something here, why inject is returning a 404 while simple-get a 400?

This is nice things. Because of this:

fastify/fastify.js

Lines 120 to 122 in 5fefda9

if (Number(process.version.match(/v(\d+)/)[1]) >= 6) {
server.on('clientError', handleClientError)
}

That error is raised inside nodejs and https://github.com/fastify/light-my-request skips that behaviour.

@delvedor
Copy link
Member

I don't like too much this discrepancy, inject should behave in the same way of any other http request.
@mcollina thoughts?
Maybe we can try to fix this directly in light-my-request.

@mcollina
Copy link
Member

@allevo can you add a test for http2 as well?

@delvedor I wouldn't bother with fixing inject.

@allevo
Copy link
Member Author

allevo commented Apr 21, 2018

@allevo can you add a test for http2 as well?

Done

Copy link
Contributor

@nwoltman nwoltman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina mcollina merged commit bec2da1 into master Apr 21, 2018
@mcollina mcollina deleted the fix-unknown-http-method branch April 21, 2018 21:30
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants