From 99b7d65504ce729db4255f2d31def0859d36e87f Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Tue, 19 Sep 2017 13:34:39 -0700 Subject: Fixing profile image tag (#7435) * Fixing profile image tag * Fixing unit test * Fixing unit test --- api4/user.go | 2 +- api4/user_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'api4') diff --git a/api4/user.go b/api4/user.go index b0d9ac699..cb1ae0fa3 100644 --- a/api4/user.go +++ b/api4/user.go @@ -214,10 +214,10 @@ func getProfileImage(c *Context, w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, public", 5*60)) // 5 mins } else { w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%v, public", 24*60*60)) // 24 hrs + w.Header().Set(model.HEADER_ETAG_SERVER, etag) } w.Header().Set("Content-Type", "image/png") - w.Header().Set(model.HEADER_ETAG_SERVER, etag) w.Write(img) } } diff --git a/api4/user_test.go b/api4/user_test.go index 1b9553d2d..6a6436896 100644 --- a/api4/user_test.go +++ b/api4/user_test.go @@ -866,8 +866,8 @@ func TestGetProfileImage(t *testing.T) { } _, resp = Client.GetProfileImage(user.Id, resp.Etag) - if resp.StatusCode != http.StatusNotModified { - t.Fatal("Should have hit etag") + if resp.StatusCode == http.StatusNotModified { + t.Fatal("Shouldn't have hit etag") } _, resp = Client.GetProfileImage("junk", "") -- cgit v1.2.3-1-g7c22