MCPcopy
hub / github.com/cortesi/devd / TestServeFileWithContentEncoding

Function TestServeFileWithContentEncoding

fileserver/fileserver_test.go:392–407  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

390}
391
392func TestServeFileWithContentEncoding(t *testing.T) {
393 defer afterTest(t)
394 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
395 w.Header().Set("Content-Encoding", "foo")
396 ServeFile(w, r, "testdata/file")
397 }))
398 defer ts.Close()
399 resp, err := http.Get(ts.URL)
400 if err != nil {
401 t.Fatal(err)
402 }
403 _ = resp.Body.Close()
404 if g, e := resp.ContentLength, int64(-1); g != e {
405 t.Errorf("Content-Length mismatch: got %d, want %d", g, e)
406 }
407}
408
409func TestServeIndexHtml(t *testing.T) {
410 defer afterTest(t)

Callers

nothing calls this directly

Calls 4

afterTestFunction · 0.85
ServeFileFunction · 0.85
HeaderMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected