ServeHTTPContext is like ServeHTTP, but with added context
( ctx context.Context, w http.ResponseWriter, r *http.Request, )
| 245 | |
| 246 | // ServeHTTPContext is like ServeHTTP, but with added context |
| 247 | func (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 |
no test coverage detected