From 06945ab938ad9960cf70b414b5516149d5b84f76 Mon Sep 17 00:00:00 2001
From: Shivam S <152616194+BIGSUS24@users.noreply.github.com>
Date: Mon, 10 Aug 2026 23:53:42 +0530
Subject: [PATCH] Fix 5.x docs drift from 4.x conventions (part of gh-1881)
- res.type() example had a stray trailing colon and missing quotes
(image/png: -> 'image/png'), matching every sibling example in that
block and the 4.x doc.
- Reordered req.host/req.hostname to match 4.x's order (hostname then
host); only moved the blocks, didn't touch their content.
- Frontmatter description wording changed from "The request/response
object..." to "The req/res object..." to match 4.x.
---
src/content/api/5x/api/request/index.mdx | 30 +++++++++++------------
src/content/api/5x/api/response/index.mdx | 4 +--
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/content/api/5x/api/request/index.mdx b/src/content/api/5x/api/request/index.mdx
index 0340d3cd95..6cdc8db28b 100644
--- a/src/content/api/5x/api/request/index.mdx
+++ b/src/content/api/5x/api/request/index.mdx
@@ -1,6 +1,6 @@
---
title: Request Object
-description: The request object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on
+description: The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on
---
import Alert from '@components/primitives/Alert/Alert.astro';
@@ -234,13 +234,13 @@ console.dir(req.fresh);
// => true
```
-### req.host
+### req.hostname
-Contains the host derived from the `Host` HTTP header.
+Contains the hostname derived from the `Host` HTTP header.
-When the [`trust proxy` setting](/api/application/#application-settings)
+When the [`trust proxy` setting](/api/application/#options-for-trust-proxy-setting)
does not evaluate to `false`, this property will instead get the value
from the `X-Forwarded-Host` header field. This header can be set by
the client or by the proxy.
@@ -251,21 +251,17 @@ comma-separated values, in which the first value is used.
```js
// Host: "example.com:3000"
-console.dir(req.host);
-// => 'example.com:3000'
-
-// Host: "[::1]:3000"
-console.dir(req.host);
-// => '[::1]:3000'
+console.dir(req.hostname);
+// => 'example.com'
```
-### req.hostname
+### req.host
-Contains the hostname derived from the `Host` HTTP header.
+Contains the host derived from the `Host` HTTP header.
-When the [`trust proxy` setting](/api/application/#options-for-trust-proxy-setting)
+When the [`trust proxy` setting](/api/application/#application-settings)
does not evaluate to `false`, this property will instead get the value
from the `X-Forwarded-Host` header field. This header can be set by
the client or by the proxy.
@@ -276,8 +272,12 @@ comma-separated values, in which the first value is used.
```js
// Host: "example.com:3000"
-console.dir(req.hostname);
-// => 'example.com'
+console.dir(req.host);
+// => 'example.com:3000'
+
+// Host: "[::1]:3000"
+console.dir(req.host);
+// => '[::1]:3000'
```
### req.ip
diff --git a/src/content/api/5x/api/response/index.mdx b/src/content/api/5x/api/response/index.mdx
index 52b3d287f4..03fffe9c07 100644
--- a/src/content/api/5x/api/response/index.mdx
+++ b/src/content/api/5x/api/response/index.mdx
@@ -1,6 +1,6 @@
---
title: Response
-description: The response object represents the HTTP response that an Express app sends when it gets an HTTP request.
+description: The res object represents the HTTP response that an Express app sends when it gets an HTTP request.
---
import Alert from '@components/primitives/Alert/Alert.astro';
@@ -1104,7 +1104,7 @@ res.type('.html'); // => 'text/html'
res.type('html'); // => 'text/html'
res.type('json'); // => 'application/json'
res.type('application/json'); // => 'application/json'
-res.type('png'); // => image/png:
+res.type('png'); // => 'image/png'
```
Aliased as `res.contentType(type)`.