Skip to content

Commit 002c0ce

Browse files
authored
static: surround ETag with quotes (#194)
1 parent bbb5ca2 commit 002c0ce

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

static.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func staticHandler(ctx *Context, log *log.Logger, opt StaticOptions) bool {
178178

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

184184
http.ServeContent(ctx.Resp, ctx.Req.Request, file, fi.ModTime(), f)

static_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func Test_Static_Options(t *testing.T) {
201201
m.ServeHTTP(resp, req)
202202
tag := GenerateETag(string(resp.Body.Len()), "macaron.go", resp.Header().Get("last-modified"))
203203

204-
So(resp.Header().Get("ETag"), ShouldEqual, tag)
204+
So(resp.Header().Get("ETag"), ShouldEqual, `"`+tag+`"`)
205205
})
206206
}
207207

0 commit comments

Comments
 (0)