httpx

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendPrefix

func AppendPrefix(prefix string, hh http.Handler) http.Handler

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

func ParseList(value string) []string

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

func ParsePairs(value string) map[string]string

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

func URLReplace

func URLReplace(src, des string, hh http.Handler) http.Handler

URLReplace returns a handler that serves HTTP requests by replacing the request URL's Path (and RawPath if set) (use strings.Replace(path, src, des) and invoking the handler hh.

Types

type MultipartWriter

type MultipartWriter struct {
	*multipart.Writer
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL