Documentation
¶
Index ¶
- func Bytes(resp Response) ([]byte, error)
- func Decode(resp Response, target any) error
- func DownloadTo(resp Response, box sandbox.Root, path string) error
- func GetJSON[T any](url string) (T, error)
- func JSON[T any](resp Response) (T, error)
- func PathEscape(value string) string
- func QueryEscape(value string) string
- func Text(resp Response) (string, error)
- func URLTemplate(tmpl string, params map[string]string) (string, error)
- func URLWithQuery(baseURL string, params map[string]string) (string, error)
- type HTTPMethod
- type Request
- func BasicAuth(req Request, username string, password string) Request
- func BearerAuth(req Request, token string) Request
- func Body(req Request, data any) Request
- func Dump(req Request) Request
- func FormData(req Request, data map[string]string) Request
- func Header(req Request, name string, value string) Request
- func MaxBodySize(req Request, limit int64) Request
- func Method(req Request, method HTTPMethod) Request
- func New(url string) Request
- func NewExternal(url string) Request
- func OnError(req Request, target any) Request
- func OnSuccess(req Request, target any) Request
- func Retry(req Request, maxAttempts int, delayMs int) Request
- func Timeout(req Request, d time.Duration) Request
- func Trace(req Request) Request
- func Transport(req Request, t *http.Transport) Request
- func WithContext(req Request, h ctxpkg.Handle) Request
- type Response
- func CheckStatus(resp Response) (Response, error)
- func Do(req Request) (Response, error)
- func Get(url string) (Response, error)
- func GetCtx(h ctxpkg.Handle, url string) (Response, error)
- func Post(url string, data any) (Response, error)
- func PostCtx(h ctxpkg.Handle, url string, data any) (Response, error)
- func SafeGet(url string) (Response, error)
- func SafeGetCtx(h ctxpkg.Handle, url string) (Response, error)
- func SessionDo(s Session, req Request) (Response, error)
- func SessionGet(s Session, url string) (Response, error)
- func SessionPost(s Session, url string, data any) (Response, error)
- func (r Response) Bytes() ([]byte, error)
- func (r Response) Close() error
- func (r Response) Decode(target any) error
- func (r Response) DumpText() string
- func (r Response) Header(name string) string
- func (r Response) JSON[T any]() (T, error)
- func (r *Response) Raw() *http.Response
- func (r Response) Text() (string, error)
- func (r Response) TraceInfo() TraceInfo
- type Session
- type TraceInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPMethod ¶
type HTTPMethod string
const ( HTTPMethodGET HTTPMethod = "GET" HTTPMethodPOST HTTPMethod = "POST" HTTPMethodPUT HTTPMethod = "PUT" HTTPMethodPATCH HTTPMethod = "PATCH" HTTPMethodDELETE HTTPMethod = "DELETE" HTTPMethodHEAD HTTPMethod = "HEAD" HTTPMethodOPTIONS HTTPMethod = "OPTIONS" )
func AllHTTPMethod ¶
func AllHTTPMethod() []HTTPMethod
func ParseHTTPMethod ¶
func ParseHTTPMethod(s string) (HTTPMethod, error)
func (HTTPMethod) String ¶
func (e HTTPMethod) String() string
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func Method ¶
func Method(req Request, method HTTPMethod) Request
type Response ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Source Files
¶
- fetch.go
Click to show internal directories.
Click to hide internal directories.