Closed
Description
The fs.FS
argument, passed to the functions http.ServeFileFS
, http.FileServerFS
, and http.NewFileTransportFS
, must implement io.Seeker
. However, this requirement is not documented in these functions.
If io.Seeker
is not implemented, these functions may fail to serve files and instead could send a 500 error to the client. Here is the code from the serveContent
function where the error is returned:
Lines 248 to 252 in 2073b35
This error can be tricky to detect as it only appears if the "Content-Type" header of the response hasn’t been set earlier.
Note that the issue #44553 is similar, but unlike the current issue, it identifies it as a problem in the serveContent
and suggests changing it.