diff --git a/post_test.go b/post_test.go index 639308d..53f88af 100644 --- a/post_test.go +++ b/post_test.go @@ -123,6 +123,54 @@ func TestPost(t *testing.T) { }).Run(handler, t) }) + SubTest(t, "UploadLengthAndUploadDeferLengthFail", func(t *testing.T, store *MockFullDataStore) { + handler, _ := NewHandler(Config{ + DataStore: store, + }) + + (&httpTest{ + Method: "POST", + URL: "", + ReqHeader: map[string]string{ + "Tus-Resumable": "1.0.0", + "Upload-Length": "10", + "Upload-Defer-Length": "1", + }, + Code: http.StatusBadRequest, + }).Run(handler, t) + }) + + SubTest(t, "NeitherUploadLengthNorUploadDeferLengthFail", func(t *testing.T, store *MockFullDataStore) { + handler, _ := NewHandler(Config{ + DataStore: store, + }) + + (&httpTest{ + Method: "POST", + URL: "", + ReqHeader: map[string]string{ + "Tus-Resumable": "1.0.0", + }, + Code: http.StatusBadRequest, + }).Run(handler, t) + }) + + SubTest(t, "InvalidUploadDeferLengthFail", func(t *testing.T, store *MockFullDataStore) { + handler, _ := NewHandler(Config{ + DataStore: store, + }) + + (&httpTest{ + Method: "POST", + URL: "", + ReqHeader: map[string]string{ + "Tus-Resumable": "1.0.0", + "Upload-Defer-Length": "bad", + }, + Code: http.StatusBadRequest, + }).Run(handler, t) + }) + SubTest(t, "ForwardHeaders", func(t *testing.T, store *MockFullDataStore) { SubTest(t, "IgnoreXForwarded", func(t *testing.T, store *MockFullDataStore) { store.EXPECT().NewUpload(FileInfo{