MCPcopy Index your code
hub / github.com/cortesi/devd / ServeHTTPContext

Method ServeHTTPContext

fileserver/fileserver.go:247–258  ·  view source on GitHub ↗

ServeHTTPContext is like ServeHTTP, but with added context

(
	ctx context.Context, w http.ResponseWriter, r *http.Request,
)

Source from the content-addressed store, hash-verified

245
246// ServeHTTPContext is like ServeHTTP, but with added context
247func (fserver *FileServer) ServeHTTPContext(
248 ctx context.Context, w http.ResponseWriter, r *http.Request,
249) {
250 logger := termlog.FromContext(ctx)
251 logger.SayAs("debug", "debug fileserver: serving with FileServer...")
252
253 upath := stripPrefix(fserver.Prefix, r.URL.Path)
254 if !strings.HasPrefix(upath, "/") {
255 upath = "/" + upath
256 }
257 fserver.serveFile(logger, w, r, path.Clean(upath), true)
258}
259
260// Given a path and a "not found" over-ride specification, return an array of
261// over-ride paths that should be considered for serving, in priority order. We

Callers 1

ServeHTTPMethod · 0.95

Calls 2

serveFileMethod · 0.95
stripPrefixFunction · 0.85

Tested by

no test coverage detected