In Express.js, res.get() returns the HTTP response header named by field. The match is case-insensitive. Use it to inspect headers already set with res.set(), res.type(), res.append(), or helpers like res.json().
It does not read the client’s request. For incoming headers, use req.get(). Call res.get() before the response is finished; after res.headersSent is true, treat the response as closed.
Syntax
Call res.get in your Express.js app. Start with this line.
Express
res.get(field)
res.get('Content-Type');
Call
What it does
res.get(field)
Primary signature.
res.get('Content-Type');
Related call form.
Install with npm install express. Create the app with const app = express() before you use this API in an Express.js tutorial project.
GET /content-type-check
→ res.get('Content-Type') → undefined (nothing set yet)
→ Branch: type('text').send('Content-Type not set yet')
→ After type(), Content-Type becomes text/plain for the outgoing response
How It Works
Nothing set yet. Early in the handler, Content-Type is usually unset.
get returns empty. Treat falsy as “not present.”
return after send. Avoids falling through to a second response.
Official Content-Type example: after something like res.type('txt'), res.get('Content-Type') can return text/plain.
Compatibility
Runtime Support
res.get() is an Express.js response method. It runs on a Node.js server (Express 5 needs Node.js 18+). Browsers only receive the finished headers; they do not call this method.
✓ Server · Express 4 & 5
res.get()
Works wherever Express runs: Node.js is the primary target. Bun and Deno can run many Express apps with compatibility layers. Not available in the browser.
ServerNode.js runtime API
Node.js18+ for Express 5 · Express 4 supported
Supported
BunExpress-compatible server apps
Supported
DenoVia npm compatibility / adapters
Supported
res.get()Express on Node.js
Bottom line: Study and run these examples with Node.js and the express package. Pair res.set with res.get to verify outgoing headers.
Frequently Asked Questions
It returns the current value of an outgoing response header by name. The field match is case-insensitive.
req.get() reads incoming request headers from the client. res.get() reads headers you have set on the response about to be sent.
You typically get undefined. Always treat a missing header as a possible result.
No. res.get('Content-Type') and res.get('content-type') refer to the same field.
After setting a header with res.set(), res.type(), or a helper that sets headers — and before the response is finished.