Skip to content

Commit

Permalink
static: surround ETag with quotes (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
humaidq committed Apr 28, 2020
1 parent bbb5ca2 commit 002c0ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion static.go
Expand Up @@ -178,7 +178,7 @@ func staticHandler(ctx *Context, log *log.Logger, opt StaticOptions) bool {

if opt.ETag {
tag := GenerateETag(string(fi.Size()), fi.Name(), fi.ModTime().UTC().Format(http.TimeFormat))
ctx.Resp.Header().Set("ETag", tag)
ctx.Resp.Header().Set("ETag", `"`+tag+`"`)
}

http.ServeContent(ctx.Resp, ctx.Req.Request, file, fi.ModTime(), f)
Expand Down
2 changes: 1 addition & 1 deletion static_test.go
Expand Up @@ -201,7 +201,7 @@ func Test_Static_Options(t *testing.T) {
m.ServeHTTP(resp, req)
tag := GenerateETag(string(resp.Body.Len()), "macaron.go", resp.Header().Get("last-modified"))

So(resp.Header().Get("ETag"), ShouldEqual, tag)
So(resp.Header().Get("ETag"), ShouldEqual, `"`+tag+`"`)
})
}

Expand Down

0 comments on commit 002c0ce

Please sign in to comment.