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

fix(fastify): uppercase http method names #14017

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

rickdgeerling
Copy link
Contributor

Fastify expects uppercase and won't auto-add the HEAD method otherwise

Closes #13016

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

When a GET endpoint is registered with Fastify, Nest responds with 404 on a HEAD request

Issue Number: #14016

What is the new behavior?

Fastify correctly detects that the endpoint is a GET and auto-adds a HEAD handler too.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The Fastify logic is here and you can see it expects uppercase method names:
https://github.com/fastify/fastify/blob/238d8a4f78b75c88e7b69b2d97fe27dd93fc520d/lib/route.js#L210

Fastify expects uppercase and won't auto-add the HEAD method otherwise

Closes nestjs#13016
@rickdgeerling rickdgeerling marked this pull request as ready for review September 20, 2024 12:09
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8b73c825-d0d8-4cef-b907-65fac944bd49

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 92.213%

Totals Coverage Status
Change from base Build 72800da6-9207-4c7a-b092-bed81bb676c8: 0.0%
Covered Lines: 6750
Relevant Lines: 7320

💛 - Coveralls

@micalevisk
Copy link
Member

@tuxmachine could you please add a comment anywhere in that file to clarify that we must use the uppercased in there?

Ideally, integration tests should prevent this

@kamilmysliwiec kamilmysliwiec merged commit f9c5140 into nestjs:master Sep 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants