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

304 response should contain etag #3313

Merged
merged 4 commits into from
Jan 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/kit/src/runtime/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,14 @@ export async function respond(incoming, options, state = {}) {
}

const etag = `"${hash(response.body || '')}"`;
response.headers['etag'] = etag;

if (if_none_match_value === etag) {
return {
status: 304,
headers: {}
headers: response.headers
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to include content-type or any of the other headers in response.headers. We can probably move response.headers['etag'] = etag; back where it was, and do headers: { etag } here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay

};
}

response.headers['etag'] = etag;
}
}

Expand Down