Issue a warning when GET route declared before HEAD

Open
#5,004 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #7435 by @santusht06 — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Domain
api, backend

Research direction

Start with the linked router.METHOD documentation and reproduce the behavior by declaring GET and HEAD routes in that order. No source file or test is named in the issue; done would mean an agreed warning behavior is covered by a regression test without breaking existing route handling.

Written by the indexing model from the issue text.

Description

discuss enhancement

I have spent several hours debugging a HEAD route and eventually found that I had fallen foul of the note here:
https://expressjs.com/en/4x/api.html#router.METHOD

A warning may not be the right approach, but it would be nice to be notified on a HEAD route declared after a GET that the GET logic would be called. I suspect I will be neither the first nor the last to have bashed their head against a wall over this one!

Dominant language
JavaScript
Stars
69.7k
Forks
25.6k
Avg merge
2d 9h
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from expressjs/express

All issues in expressjs/express

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.