Skip to content

docs: return after sendStatus in route-specific example - #792

Open
ragib-mrb wants to merge 1 commit into
expressjs:masterfrom
ragib-mrb:docs/route-example-return
Open

ragib-mrb wants to merge 1 commit into
expressjs:masterfrom
ragib-mrb:docs/route-example-return

Conversation

@ragib-mrb

Copy link
Copy Markdown

The route-specific example calls res.sendStatus(400) without returning, so the handler keeps going and calls res.send() too. Running it as written with express 5 and posting a form without username gives a 400 followed by ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client. Adding return fixes both handlers.

@krzysdz krzysdz added the docs label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants