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

Function TestFileServerZeroByte

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

Source from the content-addressed store, hash-verified

438}
439
440func TestFileServerZeroByte(t *testing.T) {
441 defer afterTest(t)
442 fs := &FileServer{
443 "version",
444 http.Dir("."),
445 inject.CopyInject{},
446 ricetemp.MustMakeTemplates(rice.MustFindBox("../templates")),
447 []routespec.RouteSpec{},
448 "",
449 }
450 ts := httptest.NewServer(fs)
451 defer ts.Close()
452
453 res, err := http.Get(ts.URL + "/..\x00")
454 if err != nil {
455 t.Fatal(err)
456 }
457 b, err := ioutil.ReadAll(res.Body)
458 if err != nil {
459 t.Fatal("reading Body:", err)
460 }
461 if res.StatusCode == 200 {
462 t.Errorf("got status 200; want an error. Body is:\n%s", string(b))
463 }
464}
465
466type fakeFileInfo struct {
467 dir bool

Callers

nothing calls this directly

Calls 2

afterTestFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected