Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func SetRobotsTag(w http.ResponseWriter, instruction RobotIndex) {
func SetCacheControl(w http.ResponseWriter, ttl time.Duration) {
f := ttl.Seconds()
i := int(f)
s := "private, max-age=" + strconv.Itoa(i)
s := "public, max-age=" + strconv.Itoa(i)
w.Header().Add("Cache-Control", s)
}

Expand Down
2 changes: 1 addition & 1 deletion headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Test_SetCacheControl(t *testing.T) {

w := httptest.NewRecorder()
SetCacheControl(w, 4*time.Minute)
must.Eq(t, "private, max-age=240", w.Header().Get("Cache-Control"))
must.Eq(t, "public, max-age=240", w.Header().Get("Cache-Control"))
}

func Test_SetContentType(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions middles/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestCache_ServeHTTP_local(t *testing.T) {

must.Eq(t, 200, w.Code)
must.True(t, run.Load())
must.Eq(t, "private, max-age=5", w.Header().Get("Cache-Control"))
must.Eq(t, "public, max-age=5", w.Header().Get("Cache-Control"))
}

func TestCache_ServeHTTP_staging_css(t *testing.T) {
Expand All @@ -53,7 +53,7 @@ func TestCache_ServeHTTP_staging_css(t *testing.T) {

must.Eq(t, 200, w.Code)
must.True(t, run.Load())
must.Eq(t, "private, max-age=60", w.Header().Get("Cache-Control"))
must.Eq(t, "public, max-age=60", w.Header().Get("Cache-Control"))
}

func TestCache_ServeHTTP_staging_txt(t *testing.T) {
Expand All @@ -76,7 +76,7 @@ func TestCache_ServeHTTP_staging_txt(t *testing.T) {

must.Eq(t, 200, w.Code)
must.True(t, run.Load())
must.Eq(t, "private, max-age=3600", w.Header().Get("Cache-Control"))
must.Eq(t, "public, max-age=3600", w.Header().Get("Cache-Control"))
}

func TestCache_ServeHTTP_production_css(t *testing.T) {
Expand All @@ -99,7 +99,7 @@ func TestCache_ServeHTTP_production_css(t *testing.T) {

must.Eq(t, 200, w.Code)
must.True(t, run.Load())
must.Eq(t, "private, max-age=10800", w.Header().Get("Cache-Control"))
must.Eq(t, "public, max-age=10800", w.Header().Get("Cache-Control"))
}

func TestCache_ServeHTTP_production_txt(t *testing.T) {
Expand All @@ -122,5 +122,5 @@ func TestCache_ServeHTTP_production_txt(t *testing.T) {

must.Eq(t, 200, w.Code)
must.True(t, run.Load())
must.Eq(t, "private, max-age=86400", w.Header().Get("Cache-Control"))
must.Eq(t, "public, max-age=86400", w.Header().Get("Cache-Control"))
}