Documentation
¶
Index ¶
- func AppendPrefix(prefix string, hh http.Handler) http.Handler
- func Dir(root string, browsable ...bool) http.FileSystem
- func FS(fsys fs.FS, browsable ...bool) http.FileSystem
- func FixedModTimeFS(hfs http.FileSystem, mt time.Time) http.FileSystem
- func NewHeaderAppender(w http.ResponseWriter, h map[string]string) http.ResponseWriter
- func ParseList(value string) []string
- func ParsePairs(value string) map[string]string
- func URLReplace(src, des string, hh http.Handler) http.Handler
- type MultipartWriter
- func (mw *MultipartWriter) CreateFormFile(fieldname, filename string) (io.Writer, error)
- func (mw *MultipartWriter) WriteFields(fields url.Values) error
- func (mw *MultipartWriter) WriteFile(fieldname, filename string) error
- func (mw *MultipartWriter) WriteFileData(fieldname, filename string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendPrefix ¶
AppendPrefix returns a handler that serves HTTP requests by appending the given prefix from the request URL's Path (and RawPath if set) and invoking the handler hh.
func Dir ¶
func Dir(root string, browsable ...bool) http.FileSystem
Dir returns a http.FileSystem that can be used by http.FileServer(). if browsable == true, then it works the same as http.Dir() otherwise it returns a filesystem that prevents http.FileServer() to list the directory files.
func FS ¶
func FS(fsys fs.FS, browsable ...bool) http.FileSystem
FS returns a http.FileSystem that can be used by http.FileServer(). if browsable == true, then it works the same as http.FS() otherwise it returns a filesystem that prevents http.FileServer() to list the directory files.
func FixedModTimeFS ¶
func FixedModTimeFS(hfs http.FileSystem, mt time.Time) http.FileSystem
FixedModTimeFS returns a FileSystem with fixed ModTime
func NewHeaderAppender ¶
func NewHeaderAppender(w http.ResponseWriter, h map[string]string) http.ResponseWriter
NewHeaderAppender create a http.ResponseWriter to append on WriteHeader(statusCode int). if statusCode != 200, header will not append. a existing header will not be overwriten.
func ParseList ¶
ParseList parses a comma-separated list of values as described by RFC 2068 and returns list elements.
Lifted from https://code.google.com/p/gorilla/source/browse/http/parser/parser.go which was ported from urllib2.parse_http_list, from the Python standard library.
func ParsePairs ¶
ParsePairs extracts key/value pairs from a comma-separated list of values as described by RFC 2068 and returns a map[key]value. The resulting values are unquoted. If a list element doesn't contain a "=", the key is the element itself and the value is an empty string.
Lifted from https://code.google.com/p/gorilla/source/browse/http/parser/parser.go
Types ¶
type MultipartWriter ¶
func NewMultipartWriter ¶
func NewMultipartWriter(w io.Writer) *MultipartWriter
func (*MultipartWriter) CreateFormFile ¶
func (mw *MultipartWriter) CreateFormFile(fieldname, filename string) (io.Writer, error)
func (*MultipartWriter) WriteFields ¶
func (mw *MultipartWriter) WriteFields(fields url.Values) error
WriteFields calls WriteField and then writes the given fields values.
func (*MultipartWriter) WriteFile ¶
func (mw *MultipartWriter) WriteFile(fieldname, filename string) error
WriteFile calls CreateFormFile and then writes the given file.
func (*MultipartWriter) WriteFileData ¶
func (mw *MultipartWriter) WriteFileData(fieldname, filename string, data []byte) error
WriteFileData calls CreateFormFile and then writes the given file data.