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

Return code 304 based on If-Modified-Since Header #1078

Merged
merged 3 commits into from
Aug 3, 2021
Merged

Return code 304 based on If-Modified-Since Header #1078

merged 3 commits into from
Aug 3, 2021

Conversation

timonson
Copy link
Contributor

The If-Modified-Since request HTTP header makes the request conditional: the server will send back the requested resource, with a 200 status, only if it has been last modified after the given date. If the resource has not been modified since, the response will be a 304 without any body; the Last-Modified response header of a previous request will contain the date of last modification. Unlike If-Unmodified-Since, If-Modified-Since can only be used with a GET or HEAD.

When used in combination with If-None-Match, it is ignored, unless the server doesn't support If-None-Match.

The most common use case is to update a cached entity that has no associated ETag.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since

The If-Modified-Since request HTTP header makes the request conditional: the server will send back the requested resource, with a 200 status, only if it has been last modified after the given date. If the resource has not been modified since, the response will be a 304 without any body; the Last-Modified response header of a previous request will contain the date of last modification. Unlike If-Unmodified-Since, If-Modified-Since can only be used with a GET or HEAD.

When used in combination with If-None-Match, it is ignored, unless the server doesn't support If-None-Match.

The most common use case is to update a cached entity that has no associated ETag.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
@CLAassistant
Copy link

CLAassistant commented Jul 30, 2021

CLA assistant check
All committers have signed the CLA.

@kt3k
Copy link
Member

kt3k commented Jul 31, 2021

Please add test cases in http/file_server_test.ts.

@timonson timonson marked this pull request as draft July 31, 2021 15:35
@timonson timonson marked this pull request as ready for review July 31, 2021 20:31
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

@timonson Thanks! LGTM

@kt3k kt3k merged commit 5efcc78 into denoland:main Aug 3, 2021
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.

3 participants