v0.4.66 Latest Latest

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

Go to latest
Published: Jul 11, 2024 License: GPL-3.0 Imports: 13 Imported by: 0




This section is empty.


View Source
var DefaultClient = &http.Client{
	Transport: &http.Transport{
		DialContext: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		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 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",


func URL

func URL(rawURL string, params map[string]string) (string, error)


type Request

type Request struct {
	Url     string
	Method  string
	Head    http.Header
	Body    io.Reader
	Charset string

func NewRequest

func NewRequest(method, url string) *Request

func NewRequest2

func NewRequest2(method, url, headerName, headerValue string) *Request

func NewRequest3

func NewRequest3(method, url string, header map[string]string) *Request

func (*Request) File

func (ce *Request) File(fieldName, filename string, reader io.Reader) (*Response, error)

func (*Request) File2

func (ce *Request) File2(fieldName, filename string, reader io.Reader, attr map[string]string) (*Response, error)

func (*Request) Form

func (ce *Request) Form(data string) (*Response, error)

func (*Request) Form2

func (ce *Request) Form2(data map[string]string) (*Response, error)

func (*Request) Form3

func (ce *Request) Form3(reader io.Reader) (*Response, error)

func (*Request) Get

func (ce *Request) Get() (*Response, error)

func (*Request) Header

func (ce *Request) Header(headerName, headerValue string) *Request

func (*Request) HeaderMap

func (ce *Request) HeaderMap(header map[string]string) *Request

func (*Request) Json

func (ce *Request) Json(data string) (*Response, error)

func (*Request) Json2

func (ce *Request) Json2(data any) (*Response, error)

func (*Request) Json3

func (ce *Request) Json3(reader io.Reader) (*Response, error)

type Response

type Response struct {
	Url           string
	Method        string
	Status        string
	StatusCode    int
	OK            bool
	ContentLength int64
	Data          *bytes.Buffer
	Header        http.Header
	Metadata      *http.Response
	// contains filtered or unexported fields
func Head(url string) (*Response, error)

func (*Response) Buffer

func (ce *Response) Buffer() (*bytes.Buffer, error)

func (*Response) Charset

func (ce *Response) Charset() string

func (*Response) ContentType

func (ce *Response) ContentType() string

func (*Response) Cookie

func (ce *Response) Cookie() []*http.Cookie

func (*Response) GetHeader

func (ce *Response) GetHeader(name string) string

func (*Response) Json

func (ce *Response) Json(dest any) error

func (*Response) Str

func (ce *Response) Str() (string, error)

Jump to

Keyboard shortcuts

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