Skip to content

HEAD requests to GET-only routes return 404 #150

@VikramAditya33

Description

@VikramAditya33

Problem

HEAD /items/42 to a @Get(':id') route returns 404. Express automatically handles HEAD for GET routes while our adapter doesn't.

Current Behavior

Request Route Status
HEAD /items/42 @Get(':id') only 404
HEAD /items/42 @Get(':id') + @Head(':id') 200

Expected Behavior

HEAD should implicitly match GET routes, sending the same headers but no body.

Fix

In RouteRegistry.register(), when registering a GET route, also register a companion HEAD route pointing to the same handler. useStaticAssets() already does this manually at the adapter level, generalize that pattern into the registry.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions