httpx

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGet                 = "GET"
	MethodPost                = "POST"
	MethodTrace               = "TRACE"
	MethodDelete              = "DELETE"
	MethodPut                 = "PUT"
	MethodOptions             = "OPTIONS"
	MethodHead                = "HEAD"
	MethodConnect             = "CONNECT"
	ContentTypeFormUrlEncoded = "application/x-www-form-urlencoded"
	ContentTypeJson           = "application/json"
	ContentTypeFormMultipart  = "multipart/form-data"
)

Variables

This section is empty.

Functions

func Mock

func Mock() *mock

Mock returns an initialized mock.

func ServeContent

func ServeContent(w http.ResponseWriter, r *http.Request, name string, modtime time.Time, content io.ReadSeeker, size int64)

ServeContent if name is empty, filename is unknown. (used for mime type, before sniffing) if modtime.IsZero(), modtime is unknown. content must be seeked to the beginning of the file. The sizeFunc is called at most once. Its error, if any, is sent in the HTTP response.

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.Seeker
	Readdir(count int) ([]os.FileInfo, error)
	Stat() (os.FileInfo, error)
}

A File is returned by a FileSystem's Open method and can be served by the FileServer implementation.

The methods should behave the same as those on an *os.File.

type FileSystem

type FileSystem interface {
	Open(name string) (File, error)
}

A FileSystem implements access to a collection of named files. The elements in a file path are separated by slash ('/', U+002F) characters, regardless of host operating system convention.

type FormItem added in v1.0.8

type FormItem struct {
	Type       FormItemType
	Name       string
	Value      string
	FileName   string
	FileReader io.Reader
}

type FormItemType added in v1.0.8

type FormItemType int
const (
	FormItemTypeField FormItemType = iota
	FormItemTypeFile
)

Jump to

Keyboard shortcuts

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