Skip to content

Commit 16864dc

Browse files
committed
fix(routing): don't access Request headers
1 parent 3bed805 commit 16864dc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/unlucky-kids-compete.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes a regression where Astro was trying to access `Request.headers`
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import type { MiddlewareHandler } from '../../@types/astro.js';
22
import { NOOP_MIDDLEWARE_HEADER } from '../constants.js';
33

4-
export const NOOP_MIDDLEWARE_FN: MiddlewareHandler = (ctx, next) => {
5-
ctx.request.headers.set(NOOP_MIDDLEWARE_HEADER, 'true');
6-
return next();
4+
export const NOOP_MIDDLEWARE_FN: MiddlewareHandler = async (ctx, next) => {
5+
const response = await next();
6+
response.headers.set(NOOP_MIDDLEWARE_HEADER, 'true');
7+
return response;
78
};

0 commit comments

Comments
 (0)