resty

package module
v2.0.14 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 20 Imported by: 19

Documentation

Index

Constants

View Source
const (
	HeaderAccept    = "Accept"
	HeaderUserAgent = "User-Agent"
)
View Source
const (
	MIMEApplicationJSON = "application/json"
	MIMEApplicationXML  = "application/xml"
)
View Source
const (
	UAWindowsChrome = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
	UAWindowsEdge   = "" /* 129-byte string literal not displayed */
	UAMacOSChrome   = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
	UAMacOSSafari   = "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15"
	UAAndroidChrome = "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.66 Mobile Safari/537.36"
	UAIOSSafari     = "" /* 135-byte string literal not displayed */
)

Variables

Functions

func HasProxyEnv added in v2.0.6

func HasProxyEnv() bool

func ParseResp

func ParseResp[Err iRespErr, Res iRespRes](resp *Response, ee error) (t Res, _ error)

Types

type Client

type Client = resty.Client

func C

func C() *Client

func New

func New() *Client

type ROption added in v2.0.5

type ROption = optionutil.I[ROptions]

func WithAccept

func WithAccept(accept string) ROption

func WithUserAgent

func WithUserAgent(useragent string) ROption

type ROptions added in v2.0.5

type ROptions struct {
	Headers map[string]string
}

type Request

type Request = resty.Request

func R

func R(rOptions ...ROption) *Request

type RespErr

type RespErr struct {
	*Response
	// contains filtered or unexported fields
}

func AsRespErr

func AsRespErr(err error) (*RespErr, bool)

func (*RespErr) Error

func (e *RespErr) Error() string

func (*RespErr) String added in v2.0.2

func (e *RespErr) String() string

type Response

type Response = resty.Response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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