Skip to content

Commit a9c56c7

Browse files
committed
fix(#328) - use Referer instead of Referrer header
Fixes #328
1 parent 51c02fc commit a9c56c7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,11 @@ And a method:
418418
A method to simplify redirecting the response to another URL. It will set the
419419
`Location` header to the supplied `url` and the status to `302 Found` (unless
420420
the status is already a `3XX` status). The use of symbol `REDIRECT_BACK` as
421-
the `url` indicates that the `Referrer` header in the request should be used
422-
as the direction, with the `alt` being the alternative location if the
423-
`Referrer` is not set. If neither the `alt` nor the `Referrer` are set, the
424-
redirect will occur to `/`. A basic HTML (if the requestor supports it) or a
425-
text body will be set explaining they are being redirected.
421+
the `url` indicates that the `Referer` header in the request should be used as
422+
the direction, with the `alt` being the alternative location if the `Referer`
423+
is not set. If neither the `alt` nor the `Referer` are set, the redirect will
424+
occur to `/`. A basic HTML (if the requestor supports it) or a text body will
425+
be set explaining they are being redirected.
426426

427427
### Automatic response body handling
428428

docs/FAQ.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ await app.listen({ port: 8000 });
7676
```
7777

7878
The symbol `REDIRECT_BACK` can be used to redirect the requestor back to the to
79-
the referrer (if the request's `Referrer` header has been set), and the second
79+
the referrer (if the request's `Referer` header has been set), and the second
8080
argument can be used to provide a "backup" if there is no referrer. For example:
8181

8282
```ts

response.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export class Response {
292292
alt: string | URL = "/",
293293
): void {
294294
if (url === REDIRECT_BACK) {
295-
url = this.#request.headers.get("Referrer") ?? String(alt);
295+
url = this.#request.headers.get("Referer") ?? String(alt);
296296
} else if (typeof url === "object") {
297297
url = String(url);
298298
}

0 commit comments

Comments
 (0)