Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

fix(ssrServer): fastify scope resulted in hooks being called more than once #1242

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion __tests__/integration/one-app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('Tests that require Docker setup', () => {
},
});

expect(response.status).toBe(200);
expect(response.status).toBe(404);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only 200 because the application error caused by this bug was not setting the HTTP status and it defaulted to 200. Fixed in #1243

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some more background this test did not change when we migrated from express to fastify. However, it was correct in express. The cors express middleware does not change the HTTP status on preflight rejection and it defaults to 200. The @fastify/cors package calls reply.callNotFound on preflight rejection.

// preflight-only headers
const rawHeaders = response.headers.raw();
expect(rawHeaders).not.toHaveProperty('access-control-max-age');
Expand Down
Loading
Loading