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

304 response should contain etag #3313

merged 4 commits into from Jan 13, 2022

Conversation

vicky1999
Copy link
Contributor

Solves #3286

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpx changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented Jan 12, 2022

⚠️ No Changeset found

Latest commit: d749576

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Jan 12, 2022

✔️ Deploy Preview for kit-demo canceled.

🔨 Explore the source changes: 905d5b7

🔍 Inspect the deploy log: https://app.netlify.com/sites/kit-demo/deploys/61df8ec687fc47000710f502


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

@vicky1999
Copy link
Contributor Author

only etag is added to the response if it is a 304 response

@Rich-Harris
Copy link
Member

On a closer reading of the original thread, we do need to preserve headers, but only certain ones. I've updated this branch. Thanks!

@Maggi64
Copy link

Maggi64 commented Jan 13, 2022

Yes that looks like it would fit the spec, thanks!

@Rich-Harris Rich-Harris merged commit 0eb4358 into sveltejs:master Jan 13, 2022
@bluwy bluwy linked an issue Jan 13, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

304 responses should contain etag
5 participants