Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override the Cache-Control header with no-cache for error responses #692

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thomasdax98
Copy link
Member

see Demo PR for more info: vivid-planet/comet#3269

manuelblum
manuelblum previously approved these changes Jan 27, 2025
@thomasdax98 thomasdax98 added the recommended-change Change should be added to existing projects and be mentioned in the next migration guide label Jan 27, 2025
Comment on lines +61 to +65
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// Reason: TS complains about passing unknown[] to writeHead, however explicit typing is complicated
// because writeHead can be overloaded and has two signatures
return originalWriteHead.apply(this, [statusCode, ...args]);
Copy link
Member Author

Choose a reason for hiding this comment

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

Passing the args as unknown[] to originalWriteHead causes the typescript error Type 'unknown' is not assignable to type 'OutgoingHttpHeaders | OutgoingHttpHeader[] | undefined'.. This only happens in the starter, it didn't happen in Demo.

Since writeHead can be overloaded and has two signatures, correct typing is hard. So I opted for just ignoring the error here.

@thomasdax98 thomasdax98 marked this pull request as draft January 27, 2025 11:48
@johnnyomair johnnyomair removed their request for review January 28, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recommended-change Change should be added to existing projects and be mentioned in the next migration guide
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants