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

Function ServeContent

fileserver/fileserver_test.go:50–63  ·  view source on GitHub ↗
(w http.ResponseWriter, req *http.Request, name string, modtime time.Time, content io.ReadSeeker)

Source from the content-addressed store, hash-verified

48}
49
50func ServeContent(w http.ResponseWriter, req *http.Request, name string, modtime time.Time, content io.ReadSeeker) error {
51 sizeFunc := func() (int64, error) {
52 size, err := content.Seek(0, os.SEEK_END)
53 if err != nil {
54 return 0, errSeeker
55 }
56 _, err = content.Seek(0, os.SEEK_SET)
57 if err != nil {
58 return 0, errSeeker
59 }
60 return size, nil
61 }
62 return serveContent(inject.CopyInject{}, w, req, name, modtime, sizeFunc, content)
63}
64
65const (
66 testFile = "testdata/file"

Callers 1

TestServeContentFunction · 0.85

Calls 1

serveContentFunction · 0.85

Tested by

no test coverage detected