Documentation
¶
Index ¶
- Variables
- type ContentType
- type Encoder
- type FormDataEncoder
- type GetEncoder
- type HTTP
- func (h *HTTP) Add(fn ...Handler) *HTTP
- func (h *HTTP) AddHeader(k, v string) *HTTP
- func (h *HTTP) AppendBody(p []byte) *HTTP
- func (h *HTTP) AppendBodyString(s string) *HTTP
- func (h *HTTP) DelAllCookies() *HTTP
- func (h *HTTP) DelCookie(k string) *HTTP
- func (h *HTTP) DelHeader(k string) *HTTP
- func (h *HTTP) DoRelease() error
- func (h *HTTP) ParserData(arr ...Parser) *HTTP
- func (h *HTTP) Put()
- func (h *HTTP) ReadBody(r *bufio.Reader, contentLength int, maxBodySize int) *HTTP
- func (h *HTTP) Request(retry int, isFail func(error, *fasthttp.Response) bool, timeout time.Duration) *HTTP
- func (h *HTTP) SetBody(body []byte) *HTTP
- func (h *HTTP) SetBodyStream(bodyStream io.Reader, bodySize int) *HTTP
- func (h *HTTP) SetBodyString(body string) *HTTP
- func (h *HTTP) SetBodyWithEncoder(ge GetEncoder, body any) *HTTP
- func (h *HTTP) SetByteRange(startPos, endPos int) *HTTP
- func (h *HTTP) SetClient(client *fasthttp.Client) *HTTP
- func (h *HTTP) SetConnectionClose() *HTTP
- func (h *HTTP) SetContentEncoding(contentEncoding string) *HTTP
- func (h *HTTP) SetContentLength(contentLength int) *HTTP
- func (h *HTTP) SetContentType(contentType ContentType) *HTTP
- func (h *HTTP) SetCookie(k, v string) *HTTP
- func (h *HTTP) SetHeader(k, v string) *HTTP
- func (h *HTTP) SetHost(host string) *HTTP
- func (h *HTTP) SetMethod(method Method) *HTTP
- func (h *HTTP) SetMultipartFormBoundary(boundary string) *HTTP
- func (h *HTTP) SetProtocol(p string) *HTTP
- func (h *HTTP) SetProxy(addr string) *HTTP
- func (h *HTTP) SetReferer(referer string) *HTTP
- func (h *HTTP) SetRequestURI(requestURI string) *HTTP
- func (h *HTTP) SetUserAgent(userAgent string) *HTTP
- type Handler
- type Method
- type Parser
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = fasthttp.Client{ MaxConnsPerHost: 50000, MaxIdleConnDuration: time.Second * 15, MaxConnDuration: time.Second * 10, ReadTimeout: time.Second * 90, MaxConnWaitTimeout: time.Second * 5, }
DefaultClient is a default client
Functions ¶
This section is empty.
Types ¶
type ContentType ¶
type ContentType string
const ( TextHTML ContentType = "text/html" TextPlain ContentType = "text/plain" AppOctetStream ContentType = "application/octet-stream" AppJSON ContentType = "application/json" AppFormUrlencoded ContentType = "application/x-www-form-urlencoded" AppXML ContentType = "application/xml" MultiFormData ContentType = "multipart/form-data" )
func NewContentType ¶
func NewContentType(contentType string) ContentType
func (ContentType) SetBoundary ¶
func (c ContentType) SetBoundary(boundary string) ContentType
func (ContentType) SetCharset ¶
func (c ContentType) SetCharset(charset string) ContentType
type FormDataEncoder ¶
type FormDataEncoder struct {
// contains filtered or unexported fields
}
func (FormDataEncoder) Encode ¶
func (f FormDataEncoder) Encode(_ any) error
type GetEncoder ¶
func JSON ¶
func JSON() GetEncoder
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
func (*HTTP) AppendBody ¶
func (*HTTP) AppendBodyString ¶
func (*HTTP) DelAllCookies ¶
func (*HTTP) ParserData ¶
func (*HTTP) SetBodyString ¶
func (*HTTP) SetBodyWithEncoder ¶
func (h *HTTP) SetBodyWithEncoder(ge GetEncoder, body any) *HTTP
func (*HTTP) SetByteRange ¶
func (*HTTP) SetConnectionClose ¶
func (*HTTP) SetContentEncoding ¶
func (*HTTP) SetContentLength ¶
func (*HTTP) SetContentType ¶
func (h *HTTP) SetContentType(contentType ContentType) *HTTP
func (*HTTP) SetMultipartFormBoundary ¶
func (*HTTP) SetProtocol ¶
func (*HTTP) SetReferer ¶
func (*HTTP) SetRequestURI ¶
func (*HTTP) SetUserAgent ¶
type Method ¶
type Method string
Method https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
const ( MethodGet Method = "GET" // RFC 7231, 4.3.1 MethodHead Method = "HEAD" // RFC 7231, 4.3.2 MethodPost Method = "POST" // RFC 7231, 4.3.3 MethodPut Method = "PUT" // RFC 7231, 4.3.4 MethodPatch Method = "PATCH" // RFC 5789 MethodDelete Method = "DELETE" // RFC 7231, 4.3.5 MethodConnect Method = "CONNECT" // RFC 7231, 4.3.6 MethodOptions Method = "OPTIONS" // RFC 7231, 4.3.7 MethodTrace Method = "TRACE" // RFC 7231, 4.3.8 )
Click to show internal directories.
Click to hide internal directories.