Skip to content

Commit b140a3f

Browse files
ematipicoascorbic
andauthored
fix(routing): don't access Request headers (#12498)
Co-authored-by: ascorbic <[email protected]>
1 parent 3bed805 commit b140a3f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.changeset/unlucky-kids-compete.md

+5
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`
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)