From 6b1e8a8bda1fc0fec3d47f898876e5e45fed0346 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 28 Aug 2016 15:26:12 +0200 Subject: [PATCH] Respond with the correct 200 OK code for HEAD requests Fixes #48 --- concat_test.go | 4 ++-- head_test.go | 2 +- unrouted_handler.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/concat_test.go b/concat_test.go index 4f522fb..30b1a7b 100644 --- a/concat_test.go +++ b/concat_test.go @@ -69,7 +69,7 @@ func TestConcatPartial(t *testing.T) { ReqHeader: map[string]string{ "Tus-Resumable": "1.0.0", }, - Code: http.StatusNoContent, + Code: http.StatusOK, ResHeader: map[string]string{ "Upload-Concat": "partial", }, @@ -165,7 +165,7 @@ func TestConcatFinal(t *testing.T) { ReqHeader: map[string]string{ "Tus-Resumable": "1.0.0", }, - Code: http.StatusNoContent, + Code: http.StatusOK, ResHeader: map[string]string{ "Upload-Concat": "final; http://tus.io/files/a http://tus.io/files/b", "Upload-Length": "10", diff --git a/head_test.go b/head_test.go index 9b63b59..90c5554 100644 --- a/head_test.go +++ b/head_test.go @@ -40,7 +40,7 @@ func TestHead(t *testing.T) { ReqHeader: map[string]string{ "Tus-Resumable": "1.0.0", }, - Code: http.StatusNoContent, + Code: http.StatusOK, ResHeader: map[string]string{ "Upload-Offset": "11", "Upload-Length": "44", diff --git a/unrouted_handler.go b/unrouted_handler.go index 4610760..ef7d8ea 100644 --- a/unrouted_handler.go +++ b/unrouted_handler.go @@ -313,7 +313,7 @@ func (handler *UnroutedHandler) HeadFile(w http.ResponseWriter, r *http.Request) w.Header().Set("Cache-Control", "no-store") w.Header().Set("Upload-Length", strconv.FormatInt(info.Size, 10)) w.Header().Set("Upload-Offset", strconv.FormatInt(info.Offset, 10)) - w.WriteHeader(http.StatusNoContent) + w.WriteHeader(http.StatusOK) } // PatchFile adds a chunk to an upload. Only allowed enough space is left.