Skip to content

Commit fc14ede

Browse files
conico974Nicolas Dorseuil
andauthored
Fix incorrect status code being sent from interceptor (#907)
* fix incorrect status code being sent from interceptor * Create orange-kids-sort.md --------- Co-authored-by: Nicolas Dorseuil <[email protected]>
1 parent 15d2ade commit fc14ede

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/orange-kids-sort.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/aws": patch
3+
---
4+
5+
Fix incorrect status code being sent from interceptor

packages/open-next/src/core/routing/cacheInterceptor.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ async function generateResult(
119119
);
120120
return {
121121
type: "core",
122-
statusCode: 200,
122+
// sometimes other status codes can be cached, like 404. For these cases, we should return the correct status code
123+
statusCode: cachedValue.meta?.status ?? 200,
123124
body: toReadableStream(body, false),
124125
isBase64Encoded: false,
125126
headers: {

0 commit comments

Comments
 (0)