mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 10:08:56 +08:00
serve: add test for content-disposition
This commit is contained in:
parent
a8fe16f381
commit
ee607aa373
@ -2,6 +2,8 @@ package serve
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/rclone/rclone/fs"
|
||||||
|
"github.com/rclone/rclone/fs/object"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
@ -82,3 +84,13 @@ func TestObjectBadRange(t *testing.T) {
|
|||||||
body, _ := io.ReadAll(resp.Body)
|
body, _ := io.ReadAll(resp.Body)
|
||||||
assert.Equal(t, "Bad Request\n", string(body))
|
assert.Equal(t, "Bad Request\n", string(body))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestObjectHEADContentDisposition(t *testing.T) {
|
||||||
|
w := httptest.NewRecorder()
|
||||||
|
r := httptest.NewRequest("HEAD", "http://example.com/aFile", nil)
|
||||||
|
m := fs.Metadata{"content-disposition": "inline"}
|
||||||
|
o := object.NewMemoryObject("aFile", time.Now(), []byte("")).WithMetadata(m)
|
||||||
|
Object(w, r, o)
|
||||||
|
resp := w.Result()
|
||||||
|
assert.Equal(t, "inline", resp.Header.Get("Content-Disposition"))
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user