diff options
author | 2023-02-25 09:36:19 +0100 | |
---|---|---|
committer | 2023-02-25 15:57:59 -0800 | |
commit | 2c2700a31d7349f67016a3786125597f9ee38c56 (patch) | |
tree | 9a9cef0c5d6a17946be70e709cf1d0349d05bc77 /http/response/html/html_test.go | |
parent | 8f9ccc6540be9d637b812985936f064bada8fcf3 (diff) | |
download | v2-2c2700a31d7349f67016a3786125597f9ee38c56.tar.gz v2-2c2700a31d7349f67016a3786125597f9ee38c56.tar.zst v2-2c2700a31d7349f67016a3786125597f9ee38c56.zip |
Proxy support for several media types
closes #615
closes #635
Diffstat (limited to '')
-rw-r--r-- | http/response/html/html_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/http/response/html/html_test.go b/http/response/html/html_test.go index 086935d2..62c9bb80 100644 --- a/http/response/html/html_test.go +++ b/http/response/html/html_test.go @@ -210,3 +210,32 @@ func TestRedirectResponse(t *testing.T) { t.Fatalf(`Unexpected redirect location, got %q instead of %q`, actualResult, expectedResult) } } + +func TestRequestedRangeNotSatisfiable(t *testing.T) { + r, err := http.NewRequest("GET", "/", nil) + if err != nil { + t.Fatal(err) + } + + w := httptest.NewRecorder() + + handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + RequestedRangeNotSatisfiable(w, r, "bytes */12777") + }) + + handler.ServeHTTP(w, r) + + resp := w.Result() + defer resp.Body.Close() + + expectedStatusCode := http.StatusRequestedRangeNotSatisfiable + if resp.StatusCode != expectedStatusCode { + t.Fatalf(`Unexpected status code, got %d instead of %d`, resp.StatusCode, expectedStatusCode) + } + + expectedContentRangeHeader := "bytes */12777" + actualContentRangeHeader := resp.Header.Get("Content-Range") + if actualContentRangeHeader != expectedContentRangeHeader { + t.Fatalf(`Unexpected content range header, got %q instead of %q`, actualContentRangeHeader, expectedContentRangeHeader) + } +} |