MCPcopy
hub / github.com/pocketbase/pocketbase / TestFileSystemServeMultiRange

Function TestFileSystemServeMultiRange

tools/filesystem/filesystem_test.go:846–873  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

844}
845
846func TestFileSystemServeMultiRange(t *testing.T) {
847 dir := createTestDir(t)
848 defer os.RemoveAll(dir)
849
850 fsys, err := filesystem.NewLocal(dir)
851 if err != nil {
852 t.Fatal(err)
853 }
854 defer fsys.Close()
855
856 res := httptest.NewRecorder()
857 req := httptest.NewRequest("GET", "/", nil)
858 req.Header.Add("Range", "bytes=0-20, 25-30")
859
860 if err := fsys.Serve(res, req, "image.png", "image.png"); err != nil {
861 t.Fatal(err)
862 }
863
864 result := res.Result()
865
866 if result.StatusCode != http.StatusPartialContent {
867 t.Fatalf("Expected StatusCode %d, got %d", http.StatusPartialContent, result.StatusCode)
868 }
869
870 if ct := result.Header.Get("Content-Type"); !strings.HasPrefix(ct, "multipart/byteranges; boundary=") {
871 t.Fatalf("Expected Content-Type to be multipart/byteranges, got %v", ct)
872 }
873}
874
875func TestFileSystemCreateThumb(t *testing.T) {
876 dir := createTestDir(t)

Callers

nothing calls this directly

Calls 7

NewLocalFunction · 0.92
ServeMethod · 0.80
createTestDirFunction · 0.70
CloseMethod · 0.65
GetMethod · 0.65
RemoveAllMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…