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

Support setting cache-control of object #1730

Merged
merged 5 commits into from
Sep 22, 2024

Conversation

gavin726
Copy link
Contributor

No description provided.

@gavin726 gavin726 changed the title Sup set cache control Support setting cache-control of object Aug 27, 2024
@gavin726
Copy link
Contributor Author

Hi, @fsouza , The simulator is very cool!
I use it in local unit testing. There is a scenario where I will set cache-control of object and need to get and check it. Currently, the simulator does not support it, so this PR supports setting cache-control. Please help review it when you are free, and if there is any problem with it, feel free to ping me, thank you!

Copy link
Owner

@fsouza fsouza left a comment

Choose a reason for hiding this comment

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

Looks good in general. Please update the .gitignore file and I can merge it! 😁

Also, do you not want to set the Cache-Control header in the download object response? (

} else {
if obj.ContentType != "" {
w.Header().Set(contentTypeHeader, obj.ContentType)
}
// If content was transcoded, the underlying encoding was removed so we shouldn't report it.
if obj.ContentEncoding != "" && !transcoded {
w.Header().Set("Content-Encoding", obj.ContentEncoding)
}
// X-Goog-Stored-Content-Encoding must be set to the original encoding,
// defaulting to "identity" if no encoding was set.
storedContentEncoding := "identity"
if obj.ContentEncoding != "" {
storedContentEncoding = obj.ContentEncoding
}
w.Header().Set("X-Goog-Stored-Content-Encoding", storedContentEncoding)
)

.gitignore Outdated Show resolved Hide resolved
@fsouza fsouza merged commit 88d8d3d into fsouza:main Sep 22, 2024
38 checks passed
jonmseaman pushed a commit to jonmseaman/fake-gcs-server that referenced this pull request Sep 22, 2024
* Update .gitignore

* Support to set object's CacheControl

* Revert "Update .gitignore"

This reverts commit 35d70c3.

* fakestorage: set `Cache-Control` in the `downloadObject` endpoint

---------

Co-authored-by: francisco souza <[email protected]>
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