diff --git a/pkg/handler/head_test.go b/pkg/handler/head_test.go index 48c7f87..ab5af62 100644 --- a/pkg/handler/head_test.go +++ b/pkg/handler/head_test.go @@ -26,8 +26,8 @@ func TestHead(t *testing.T) { Offset: 11, Size: 44, MetaData: map[string]string{ - "name": "lunrjs.png", - "type": "image/png", + "name": "lunrjs.png", + "empty": "", }, }, nil), lock.EXPECT().Unlock().Return(nil), @@ -57,8 +57,8 @@ func TestHead(t *testing.T) { // Since the order of a map is not guaranteed in Go, we need to be prepared // for the case, that the order of the metadata may have been changed - if v := res.Header().Get("Upload-Metadata"); v != "name bHVucmpzLnBuZw==,type aW1hZ2UvcG5n" && - v != "type aW1hZ2UvcG5n,name bHVucmpzLnBuZw==" { + if v := res.Header().Get("Upload-Metadata"); v != "name bHVucmpzLnBuZw==,empty " && + v != "empty ,name bHVucmpzLnBuZw==" { t.Errorf("Expected valid metadata (got '%s')", v) } }) diff --git a/pkg/handler/post_test.go b/pkg/handler/post_test.go index 431f04c..00ae801 100644 --- a/pkg/handler/post_test.go +++ b/pkg/handler/post_test.go @@ -23,16 +23,18 @@ func TestPost(t *testing.T) { store.EXPECT().NewUpload(context.Background(), FileInfo{ Size: 300, MetaData: map[string]string{ - "foo": "hello", - "bar": "world", + "foo": "hello", + "bar": "world", + "empty": "", }, }).Return(upload, nil), upload.EXPECT().GetInfo(context.Background()).Return(FileInfo{ ID: "foo", Size: 300, MetaData: map[string]string{ - "foo": "hello", - "bar": "world", + "foo": "hello", + "bar": "world", + "empty": "", }, }, nil), ) @@ -52,7 +54,7 @@ func TestPost(t *testing.T) { "Tus-Resumable": "1.0.0", "Upload-Length": "300", // Invalid Base64-encoded values should be ignored - "Upload-Metadata": "foo aGVsbG8=, bar d29ybGQ=, hah INVALID", + "Upload-Metadata": "foo aGVsbG8=, bar d29ybGQ=, hah INVALID, empty", }, Code: http.StatusCreated, ResHeader: map[string]string{