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

add cache control header option #172

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

karthik2804
Copy link
Contributor

Adds an optional header field to allow the browser to cache the responses.

Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

Should there be any documentation for this feature? It appears to be user-facing.

.head
.cache_control
.clone()
.unwrap_or_else(|| DEFAULT_CACHE_CONTROL.to_owned());
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a change in behaviour, I think, defaulting to instructing no-cache instead of not caring? Is that intentional? If so, maybe leave a comment on why?

Should users have a way to omit the cache-control header instead of using no-cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I will just make the adding of the header optional.

@karthik2804
Copy link
Contributor Author

karthik2804 commented Jun 25, 2023

@itowlson I will add docs to developer once this gets in and gets close to a release

@itowlson
Copy link
Contributor

Ah, of course, the docs are in a separate repo, as I perfectly well knew. I feebly plead Monday.

Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

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

tiny typo but LGTM!

src/content.rs Outdated
@@ -50,6 +50,11 @@ pub struct Head {
///
/// This may result in HTTP headers being altered.
pub content_type: Option<String>,
/// Cache Control header override.
///
/// The default is to send no cachce control headers. This should only be
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// The default is to send no cachce control headers. This should only be
/// The default is to send no cache control headers. This should only be

Signed-off-by: karthik2804 <karthik.ganeshram@fermyon.com>
@itowlson itowlson merged commit cafcc57 into fermyon:main Sep 27, 2023
@vdice vdice mentioned this pull request Oct 9, 2023
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.

2 participants