net/http: ServeContent add Cache-Control header #47539
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
I don't know
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
calling
http.ServeContent
to serve file from the server, it doesn't send "Cache-Control" header at all, and even the source codefs.go
doesn't mention it.What did you expect to see?
According to retrofit (the famous Android HTTP client), it needs to see Cache-Control with value must-revalidate on the response header so it can send the HTTP request with "if-modified-since" HTTP request header. and hence
http.ServeContent
doesn't send such a header, then the resources are kept in Retrofit cache forever.What did you see instead?
http.ServeContent doesn't send "Cache-Control" response header at all.
The text was updated successfully, but these errors were encountered: