Repository navigation
Conversation
Run each example against express@5.3.0 and express@4.22.3 and correct
the claims that do not match:
- req.is() with a wildcard type returns the matched content type
('text/html', 'application/json'), not the wildcard.
- res.type() sets 'text/html; charset=utf-8' and
'application/json; charset=utf-8', since res.set() adds the charset.
- res.cookie() with encode: String emits no trailing ';'.
- Object cookie values are parsed back by cookieParser(), not
bodyParser().
- express.static dotfiles "deny" and "ignore" call next() by default;
the 403/404 only happens via next(err) when fallthrough is false.
- 5.x only: res.attachment() sends filename=logo.png without quotes
(content-disposition@1 only quotes when needed).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NQDmA3mwGfL83pbg9WQ6ey
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What this changes
I ran the examples in the 4.x and 5.x API reference against a local server, using real HTTP requests, with express@5.3.0 and express@4.22.3. These claims did not match what Express does:
req.is()with a wildcard (4.x and 5.x). WithContent-Type: text/html; charset=utf-8,req.is('text/*')returns'text/html', not'text/*'. Withapplication/json,req.is('application/*')returns'application/json'. type-is returns the real type when the pattern has a*.res.type()(4.x and 5.x). Afterres.type('html')the header istext/html; charset=utf-8. Same for.html,jsonandapplication/json.res.set()adds the charset.pngstaysimage/png, so that line is unchanged.res.cookie()withencode: String(4.x and 5.x). The real header is...; Domain=example.com; Path=/. There is no trailing;.res.cookie()with an object value (4.x and 5.x). The text said the value is parsed bybodyParser(). It iscookieParser()that reads thej:JSON cookie back. I checked thatreq.cookies.cartcomes back as{ items: [1, 2, 3] }andreq.bodyisundefined.express.staticdotfiles(4.x and 5.x). The text said "deny" responds with403and "ignore" with404, and thennext()is called. With the defaultfallthrough: true, both just callnext(). Withfallthrough: false, they callnext(err)with a 403 or 404 error. I reworded both lines to say that. This matches the "403/next()" and "404/next()" notes in the serve-static README.res.attachment('path/to/logo.png')(5.x only). Express 5 sendsContent-Disposition: attachment; filename=logo.pngwith no quotes, because content-disposition@1 only quotes when it has to. Express 4 still sendsfilename="logo.png", so I left the 4.x page alone.How I checked it
I started an app with
app.listen(0)and sent requests withhttp.request. The same script ran against both versions:I also ran the other result comments on these pages, including
req.accepts*,req.range,req.route,res.format,res.links,app.param,app.mountpath,app.path(),express.json/urlencodedand the router examples. They match, so I did not touch them.prettier --checkpasses on the changed files. The changes add no new words for cspell.