mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: make ServeContent support dates in If-Range headers
Fixes #8367 LGTM=adg R=adg CC=golang-codereviews https://golang.org/cl/116300044
This commit is contained in:
parent
20a5de9eb6
commit
f5037ee127
2 changed files with 39 additions and 8 deletions
|
|
@ -721,6 +721,28 @@ func TestServeContent(t *testing.T) {
|
|||
wantStatus: 200,
|
||||
wantContentType: "text/css; charset=utf-8",
|
||||
},
|
||||
"range_with_modtime": {
|
||||
file: "testdata/style.css",
|
||||
modtime: time.Date(2014, 6, 25, 17, 12, 18, 0 /* nanos */, time.UTC),
|
||||
reqHeader: map[string]string{
|
||||
"Range": "bytes=0-4",
|
||||
"If-Range": "Wed, 25 Jun 2014 17:12:18 GMT",
|
||||
},
|
||||
wantStatus: StatusPartialContent,
|
||||
wantContentType: "text/css; charset=utf-8",
|
||||
wantLastMod: "Wed, 25 Jun 2014 17:12:18 GMT",
|
||||
},
|
||||
"range_with_modtime_nanos": {
|
||||
file: "testdata/style.css",
|
||||
modtime: time.Date(2014, 6, 25, 17, 12, 18, 123 /* nanos */, time.UTC),
|
||||
reqHeader: map[string]string{
|
||||
"Range": "bytes=0-4",
|
||||
"If-Range": "Wed, 25 Jun 2014 17:12:18 GMT",
|
||||
},
|
||||
wantStatus: StatusPartialContent,
|
||||
wantContentType: "text/css; charset=utf-8",
|
||||
wantLastMod: "Wed, 25 Jun 2014 17:12:18 GMT",
|
||||
},
|
||||
}
|
||||
for testName, tt := range tests {
|
||||
var content io.ReadSeeker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue