(t *testing.T)
| 844 | } |
| 845 | |
| 846 | func 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 | |
| 875 | func TestFileSystemCreateThumb(t *testing.T) { |
| 876 | dir := createTestDir(t) |
nothing calls this directly
no test coverage detected
searching dependent graphs…