Documentation ¶
Overview ¶
Package httpasset provides a http.Handler that will serve files using the methods generated by go-bindata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCompressed ¶
func NewCompressed(asset, compressed AssetAndInfo) http.Handler
NewCompressed returns a new asset filesystem that will optionally serve precompressed .gz and .br resources from compressed.
func NewCompressedWithETag ¶
func NewCompressedWithETag(asset, compressed AssetAndInfo, etagLen int) http.Handler
NewCompressedWithETag returns a new asset filesystem that will optionally serve precompressed .gz and .br resources from compressed. It will include an ETag derived from the assets FileHash() if implemented.
func NewWithETag ¶
func NewWithETag(asset AssetAndInfo, etagLen int) http.Handler
NewWithETag returns a new asset filesystem that will include an ETag derived from the assets FileHash() if implemented.
Types ¶
type AssetAndInfo ¶
AssetAndInfo represents the generated AssetAndInfo method.
type FileServer ¶
type FileServer struct { Asset AssetAndInfo Brotli AssetAndInfo Gzip AssetAndInfo EtagLen int }
FileServer is a http.Handler that serves files from the provided AssetAndInfo methods.
It will serve files from Asset by default but will try to serve files from Brotli if the client supports brotli compression, or from Gzip if client only supports Gzip.
EtagLen optionally specifies the length of Etags to generate, if the os.FileInfo returned by Asset implements the FileHash() method. The Etag will be a hexadecimal encoded string truncated to EtagLen.
func (*FileServer) ServeHTTP ¶
func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request)