Documentation ¶
Index ¶
- Variables
- func URL(rawURL string, params map[string]string) (string, error)
- type DefaultHttpHandler
- type HttpHandler
- type Request
- func (ce *Request) AddHeader(headerName, headerValue string) *Request
- func (ce *Request) AddHeaderMap(header map[string]string) *Request
- func (ce *Request) File(fieldName, filename string, reader io.Reader) (*Response, error)
- func (ce *Request) File2(fieldName, filename string, reader io.Reader, attr map[string]string) (*Response, error)
- func (ce *Request) FormBody(data string) (*Response, error)
- func (ce *Request) FormBody2(data map[string]string) (*Response, error)
- func (ce *Request) FormBody3(reader io.Reader) (*Response, error)
- func (ce *Request) Get() (*Response, error)
- func (ce *Request) GetParams(params map[string]string) (*Response, error)
- func (ce *Request) JsonBody(data string) (*Response, error)
- func (ce *Request) JsonBody2(data any) (*Response, error)
- func (ce *Request) JsonBody3(reader io.Reader) (*Response, error)
- type Response
- func (ce *Response) Buffer() (*bytes.Buffer, error)
- func (ce *Response) Charset() string
- func (ce *Response) ContentType() string
- func (ce *Response) Cookie() []*http.Cookie
- func (ce *Response) GetHeader(name string) string
- func (ce *Response) Json(dest any) error
- func (ce *Response) Str() (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = &http.Client{ Transport: &http.Transport{ DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, MaxIdleConns: 500, MaxIdleConnsPerHost: 500, IdleConnTimeout: 30 * time.Second, TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, }, Timeout: 10 * time.Second, }
View Source
var DefaultHttpHandlerInstance = DefaultHttpHandler{}
View Source
var HeaderNames = &headerName{
Accept: "accept",
AcceptCharset: "accept-charset",
AcceptEncoding: "accept-encoding",
AcceptLanguage: "accept-language",
AcceptRanges: "accept-ranges",
AcceptPatch: "accept-patch",
AcceptControlAllowCredentials: "access-control-allow-credentials",
AcceptControlAllowHeaders: "access-control-allow-headers",
AcceptControlAllowMethods: "access-control-allow-methods",
AcceptControlAllowOrigin: "access-control-allow-origin",
AcceptControlExposeHeaders: "access-control-expose-headers",
AcceptControlMaxAge: "access-control-max-age",
AcceptControlRequestHeaders: "access-control-request-headers",
AcceptControlRequestMethod: "access-control-request-method",
Age: "age",
Allow: "allow",
Authorization: "authorization",
CacheControl: "cache-control",
Connection: "connection",
ContentEncoding: "content-encoding",
ContentLanguage: "content-language",
ContentLength: "content-length",
ContentLocation: "content-location",
ContentTransferEncoding: "content-transfer-encoding",
ContentDisposition: "content-disposition",
ContentMd5: "content-md5",
ContentRange: "content-range",
ContentSecurityPolicy: "content-security-policy",
ContentType: "content-type",
Cookie: "cookie",
Date: "date",
Dnt: "dnt",
Etag: "etag",
Expect: "expect",
Expires: "expires",
From: "from",
Host: "host",
IfMatch: "if-match",
IfNoneMatch: "if-none-match",
IfRange: "if-range",
IfUnmodifiedSince: "if-unmodified-since",
KeepAlive: "keep-alive",
LastModified: "last-modified",
Location: "location",
MaxForwards: "max-forwards",
Origin: "origin",
Pragma: "pragma",
ProxyAuthenticate: "proxy-authenticate",
ProxyAuthorization: "proxy-authorization",
ProxyConnection: "proxy-connection",
Range: "range",
Referer: "referer",
RetryAfter: "retry-after",
SecWebsocketKey1: "sec-websocket-key1",
SecWebsocketKey2: "sec-websocket-key2",
SecWebsocketLocation: "sec-websocket-location",
SecWebsocketOrigin: "sec-websocket-origin",
SecWebsocketProtocol: "sec-websocket-protocol",
SecWebsocketVersion: "sec-websocket-version",
SecWebsocketKey: "sec-websocket-key",
SecWebsocketAccept: "sec-websocket-accept",
SecWebsocketExtensions: "sec-websocket-extensions",
Server: "server",
SetCookie: "set-cookie",
SetCookie2: "set-cookie2",
Te: "te",
Trailer: "trailer",
TrailerEncoding: "transfer-encoding",
Upgrade: "upgrade",
UpgradeInsecureRequests: "upgrade-insecure-requests",
UserAgent: "user-agent",
Vary: "vary",
Via: "via",
Warning: "warning",
WebsocketLocation: "websocket-location",
WebsocketOrigin: "websocket-origin",
WebsocketProtocol: "websocket-protocol",
WwwAuthenticate: "www-authenticate",
XFrameOptions: "x-frame-options",
XRequestedWith: "x-requested-with",
}
Functions ¶
Types ¶
type DefaultHttpHandler ¶ added in v0.4.70
type DefaultHttpHandler struct { }
type HttpHandler ¶ added in v0.4.70
type Request ¶
type Request struct { Url string Method string Params map[string]string Head http.Header Body io.Reader Charset string Handler HttpHandler }
func NewRequest ¶
func NewRequest2 ¶
func (*Request) AddHeaderMap ¶ added in v0.4.70
Click to show internal directories.
Click to hide internal directories.