Documentation
¶
Index ¶
- Constants
- Variables
- func ParseJsonResponse[T any](resp Response) (data T, err error)
- func ParseXmlResponse[T any](resp Response) (data T, err error)
- func SetPayloadProcessor(contentType string, marshaller func(in []byte, receiver any) error)
- type Chain
- type Client
- type ContentType
- type ContentTypeMismatchError
- type Context
- type ContextOpts
- func WithContext[request any, response any](rawCtx context.Context) ContextOpts[request, response]
- func WithCookieParams[request any, response any](params Params) ContextOpts[request, response]
- func WithError[request any, response any](err error) ContextOpts[request, response]
- func WithExtraParams[request any, response any](params Params) ContextOpts[request, response]
- func WithHeaderParams[request any, response any](params Params) ContextOpts[request, response]
- func WithPathParams[request any, response any](params Params) ContextOpts[request, response]
- func WithQueryParams[request any, response any](params Params) ContextOpts[request, response]
- func WithRawRequest[request any, response any](raw *http.Request) ContextOpts[request, response]
- func WithRequest[request any, response any](req request) ContextOpts[request, response]
- func WithRequestHeader[request any, response any](headers RequestHeader) ContextOpts[request, response]
- func WithResponse[request any, response any](resp response) ContextOpts[request, response]
- func WithResponseHeaders[request any, response any](headers Params) ContextOpts[request, response]
- func WithSetCookies[request any, response any](cookies []Cookie) ContextOpts[request, response]
- func WithSetHeaders[request any, response any](headers Params) ContextOpts[request, response]
- func WithStatusCode[request any, response any](status int) ContextOpts[request, response]
- type Cookie
- type EndPoint
- func (ep *EndPoint[request, response]) AddParsingCookies(key string, necessary bool)
- func (ep *EndPoint[request, response]) AddParsingHeaders(key string, necessary bool)
- func (ep *EndPoint[request, response]) AddParsingParams(key string, necessary bool)
- func (ep *EndPoint[request, response]) AddParsingQueries(key string, necessary bool)
- func (ep *EndPoint[request, response]) Serve(ctx *gin.Context)
- func (ep *EndPoint[request, response]) SetAllowedMethods(methods ...Method)
- func (ep *EndPoint[request, response]) SetHandlerChain(chain Chain[request, response])
- func (ep *EndPoint[request, response]) SetRequestProcessor(processor RequestProcessor[request])
- func (ep *EndPoint[request, response]) SetResponseProcessor(processor ResponseProcessor[response])
- type EndPointInterface
- type EndPointOptions
- func WithAllowedMethodsOpts[request any, response any](methods ...Method) EndPointOptions[request, response]
- func WithChainOpts[request any, response any](chain Chain[request, response]) EndPointOptions[request, response]
- func WithCookieOpts[request any, response any](cookies map[string]bool) EndPointOptions[request, response]
- func WithHeaderOpts[request any, response any](headers map[string]bool) EndPointOptions[request, response]
- func WithParamOpts[request any, response any](params map[string]bool) EndPointOptions[request, response]
- func WithQueryOpts[request any, response any](queries map[string]bool) EndPointOptions[request, response]
- func WithRequestProcessorOpts[request any, response any](processor RequestProcessor[request]) EndPointOptions[request, response]
- func WithResponseProcessorOpts[request any, response any](processor ResponseProcessor[response]) EndPointOptions[request, response]
- func WithRouterOpts[request any, response any](router Router) EndPointOptions[request, response]
- type Engine
- type Handler
- type Method
- type MethodCode
- type MethodNotAllowedError
- type NecessaryCookieMissingError
- type NecessaryHeaderMissingError
- type NecessaryQueryMissingError
- type Params
- type Request
- type RequestHeader
- type RequestProcessor
- type Response
- type ResponseProcessor
- type Router
- type ServerAlreadyServingError
- type Status
- type UnsupportedAcceptError
- type UnsupportedContentTypeError
- type UnsupportedMethodError
- type UserAgent
Constants ¶
const ( TraceIDKey = "trace-id" RemoteIPKey = "remote-ip" RequestTimeKey = "request-time" )
Variables ¶
var ( MethodMap = map[Method]MethodCode{ GET: CodeGet, POST: CodePost, OPTIONS: CodeOptions, HEAD: CodeHead, PUT: CodePut, DELETE: CodeDelete, TRACE: CodeTrace, CONNECT: CodeConnect, PATCH: CodePatch, } MethodCodeMap = map[MethodCode]Method{ CodeGet: GET, CodePost: POST, CodeOptions: OPTIONS, CodeHead: HEAD, CodePut: PUT, CodeDelete: DELETE, CodeTrace: TRACE, CodeConnect: CONNECT, CodePatch: PATCH, } )
Functions ¶
func ParseJsonResponse ¶
ParseJsonResponse parse json response from http response example:
type User struct {
Name string `json:"name"`
}
func main() {
request := NewRequest().SetUrl("https://example.com/api/user").SetAccept(ContentTypeJson)
responseData, parseErr := ParseJsonResponse[User](NewClient().ExecuteRequest(request))
if parseErr != nil {
panic(parseErr)
}
}
func ParseXmlResponse ¶ added in v1.2.9
ParseXmlResponse parse xml response from http response example:
type User struct {
Name string `xml:"name"`
}
func main() {
request := NewRequest().SetUrl("https://example.com/api/user").SetAccept(ContentTypeXml)
responseData, parseErr := ParseXmlResponse[User](NewClient().ExecuteRequest(request))
if parseErr != nil {
panic(parseErr)
}
}
Types ¶
type Chain ¶ added in v1.2.9
func NewChain ¶ added in v1.2.9
func NewChain[request any, response any](handlers ...Handler[request, response]) Chain[request, response]
NewChain creates a new handler chain. example:
chain := NewChain[request, response](
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
)
func (Chain[request, response]) AddHandlerBack ¶ added in v1.2.9
func (c Chain[request, response]) AddHandlerBack(h ...Handler[request, response]) Chain[request, response]
AddHandlerBack adds handlers to the back of the handler chain. example:
chain.AddHandlerBack(
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
)
func (Chain[request, response]) AddHandlerFront ¶ added in v1.2.9
func (c Chain[request, response]) AddHandlerFront(h ...Handler[request, response]) Chain[request, response]
AddHandlerFront adds handlers to the front of the handler chain. example:
chain.AddHandlerFront(
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
)
type ContentType ¶
type ContentType = string
const ( ContentTypeJson ContentType = "application/json" ContentTypeForm ContentType = "application/x-www-form-urlencoded" ContentTypeFileStream ContentType = "application/octet-stream" ContentTypeMultipart ContentType = "multipart/form-data" ContentTypeTextPlain ContentType = "text/plain" ContentTypeTextHtml ContentType = "text/html" ContentTypeTextXml ContentType = "text/xml" ContentTypeTextYaml ContentType = "text/yaml" ContentTypeTextCsv ContentType = "text/csv" ContentTypeImagePng ContentType = "image/png" ContentTypeImageJpeg ContentType = "image/jpeg" ContentTypeImageGif ContentType = "image/gif" )
type ContentTypeMismatchError ¶ added in v1.2.9
func (ContentTypeMismatchError) Error ¶ added in v1.2.9
func (e ContentTypeMismatchError) Error() string
type Context ¶ added in v1.2.9
type Context[request any, response any] interface { context.Context // Next calls the following handlers until abort or the end of the chain. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.Next() // // do something after returned from the following handlers // } Next() // Abort aborts the following handlers. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.Abort() // // do something after aborted // } Abort() // IsAborted returns true if the following handlers are aborted. // example: // // func handler(ctx Context[request, response]) { // // do something // if ctx.IsAborted() { // // do something if aborted // } // // do something after aborted // } IsAborted() bool // RawRequest returns the raw request. // example: // // func handler(ctx Context[request, response]) { // // do something // raw := ctx.RawRequest() // // do something with raw // } RawRequest() *http.Request // QueryParams returns the query params. // example: // // func handler(ctx Context[request, response]) { // // do something // params := ctx.QueryParams() // // do something with params // } QueryParams() Params // PathParams returns the path params. // example: // // func handler(ctx Context[request, response]) { // // do something // params := ctx.PathParams() // // do something with params // } PathParams() Params // HeaderParams returns the header params. // example: // // func handler(ctx Context[request, response]) { // // do something // params := ctx.HeaderParams() // // do something with params // } HeaderParams() Params // NormalHeaders returns the normal headers. // example: // // func handler(ctx Context[request, response]) { // // do something // headers := ctx.NormalHeaders() // // do something with headers // } NormalHeaders() RequestHeader // ExtraParams returns the extra params. // example: // // func handler(ctx Context[request, response]) { // // do something // params := ctx.ExtraParams() // // do something with params // } ExtraParams() Params // SetExtraParams sets the extra params. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.SetExtraParams("key", "value") // // do something with params // } SetExtraParams(key string, value string) // Request returns the processed request. // example: // // func handler(ctx Context[request, response]) { // // do something // req := ctx.Request() // // do something with req // } Request() request // Response returns the response. // example: // // func handler(ctx Context[request, response]) { // // do something // resp := ctx.Response() // // do something with resp // } Response() response // SetResponse sets the response. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.SetResponse(resp) // // do something with resp // } SetResponse(resp response) // ResponseHeaders returns the response headers. // example: // // func handler(ctx Context[request, response]) { // // do something // headers := ctx.ResponseHeaders() // // do something with headers // } ResponseHeaders() Params // SetResponseHeader sets the response header. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.SetResponseHeader("key", "value") // // do something with resp // } SetResponseHeader(key string, value string) // ResponseSetCookies returns the response cookies. // example: // // func handler(ctx Context[request, response]) { // // do something // cookies := ctx.ResponseSetCookies() // // do something with cookies // } ResponseSetCookies() []Cookie // SetResponseSetCookie sets the response cookie. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.SetResponseSetCookie(cookie) // // do something with resp // } SetResponseSetCookie(cookie Cookie) // StatusCode returns the status code. // example: // // func handler(ctx Context[request, response]) { // // do something // status := ctx.StatusCode() // // do something with status // } StatusCode() int // SetStatusCode sets the status code. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.SetStatusCode(StatusOK) // // do something with status // } SetStatusCode(status int) // Error returns the error. // example: // // func handler(ctx Context[request, response]) { // // do something // err := ctx.Error() // // do something with err // } Error() error // SetError sets the error. // example: // // func handler(ctx Context[request, response]) { // // do something // ctx.SetError(err) // // do something with err // } SetError(err error) // contains filtered or unexported methods }
func NewContext ¶ added in v1.2.9
func NewContext[request any, response any](opts ...ContextOpts[request, response]) Context[request, response]
type ContextOpts ¶ added in v1.2.9
func WithContext ¶ added in v1.2.9
func WithContext[request any, response any](rawCtx context.Context) ContextOpts[request, response]
func WithCookieParams ¶ added in v1.2.9
func WithCookieParams[request any, response any](params Params) ContextOpts[request, response]
func WithError ¶ added in v1.2.9
func WithError[request any, response any](err error) ContextOpts[request, response]
func WithExtraParams ¶ added in v1.2.9
func WithExtraParams[request any, response any](params Params) ContextOpts[request, response]
func WithHeaderParams ¶ added in v1.2.9
func WithHeaderParams[request any, response any](params Params) ContextOpts[request, response]
func WithPathParams ¶ added in v1.2.9
func WithPathParams[request any, response any](params Params) ContextOpts[request, response]
func WithQueryParams ¶ added in v1.2.9
func WithQueryParams[request any, response any](params Params) ContextOpts[request, response]
func WithRawRequest ¶ added in v1.2.9
func WithRawRequest[request any, response any](raw *http.Request) ContextOpts[request, response]
func WithRequest ¶ added in v1.2.9
func WithRequest[request any, response any](req request) ContextOpts[request, response]
func WithRequestHeader ¶ added in v1.2.9
func WithRequestHeader[request any, response any](headers RequestHeader) ContextOpts[request, response]
func WithResponse ¶ added in v1.2.9
func WithResponse[request any, response any](resp response) ContextOpts[request, response]
func WithResponseHeaders ¶ added in v1.2.9
func WithResponseHeaders[request any, response any](headers Params) ContextOpts[request, response]
func WithSetCookies ¶ added in v1.2.9
func WithSetCookies[request any, response any](cookies []Cookie) ContextOpts[request, response]
func WithSetHeaders ¶ added in v1.2.9
func WithSetHeaders[request any, response any](headers Params) ContextOpts[request, response]
func WithStatusCode ¶ added in v1.2.9
func WithStatusCode[request any, response any](status int) ContextOpts[request, response]
type Cookie ¶ added in v1.2.9
type Cookie struct {
Name string
Value string
Path string
Domain string
Expires string
MaxAge int
Secure bool
HttpOnly bool
}
func NewBasicCookie ¶ added in v1.2.9
type EndPoint ¶ added in v1.2.9
EndPoint is the interface for http endpoint. example:
ep := NewBasicEndPoint[request, response](http.GET, router, chain)
ep.AddParsingHeaders("Content-Type", true)
ep.AddParsingQueries("id", true)
ep.AddParsingParams("name", true)
then
GET /api/v1/user/:name?id=1 Content-Type: application/json
then in your handler
func handler(ctx Context[request, response]) {
ctx.HeaderParams().GetString("Content-Type") // application/json
ctx.QueryParams().GetInt("id") // 1
ctx.PathParams().GetString("name") // name
// do something
}
func NewBasicEndPoint ¶ added in v1.2.9
func NewBasicEndPoint[request any, response any](method Method, router Router, chain Chain[request, response]) *EndPoint[request, response]
NewBasicEndPoint creates a new EndPoint with basic options. It's a shortcut for NewEndPointWithOpts. example:
ep := NewBasicEndPoint[request, response](http.GET, router, chain)
func NewEndPointWithOpts ¶ added in v1.2.9
func NewEndPointWithOpts[request any, response any](opts ...EndPointOptions[request, response]) *EndPoint[request, response]
NewEndPointWithOpts creates a new EndPoint with options. example:
ep := NewEndPointWithOpts[request, response]( WithRouterOpts[request, response](router), WithChainOpts[request, response](chain), WithHeaderOpts[request, response](headers), WithQueryOpts[request, response](queries), WithParamOpts[request, response](params), WithRequestProcessorOpts[request, response](processor), WithResponseProcessorOpts[request, response](processor), WithAllowedMethodsOpts[request, response](methods...), )
func (*EndPoint[request, response]) AddParsingCookies ¶ added in v1.2.9
func (*EndPoint[request, response]) AddParsingHeaders ¶ added in v1.2.9
func (*EndPoint[request, response]) AddParsingParams ¶ added in v1.2.9
func (*EndPoint[request, response]) AddParsingQueries ¶ added in v1.2.9
func (*EndPoint[request, response]) SetAllowedMethods ¶ added in v1.2.9
func (*EndPoint[request, response]) SetHandlerChain ¶ added in v1.2.9
func (*EndPoint[request, response]) SetRequestProcessor ¶ added in v1.2.9
func (ep *EndPoint[request, response]) SetRequestProcessor(processor RequestProcessor[request])
func (*EndPoint[request, response]) SetResponseProcessor ¶ added in v1.2.9
func (ep *EndPoint[request, response]) SetResponseProcessor(processor ResponseProcessor[response])
type EndPointInterface ¶ added in v1.2.9
type EndPointInterface interface {
// contains filtered or unexported methods
}
type EndPointOptions ¶ added in v1.2.9
EndPointOptions is the options for EndPoint. example:
ep := NewEndPointWithOpts[request, response]( WithRouterOpts[request, response](router), WithChainOpts[request, response](chain), WithHeaderOpts[request, response](headers), WithQueryOpts[request, response](queries), WithParamOpts[request, response](params), WithRequestProcessorOpts[request, response](processor), WithResponseProcessorOpts[request, response](processor), WithAllowedMethodsOpts[request, response](methods...), )
func WithAllowedMethodsOpts ¶ added in v1.2.9
func WithAllowedMethodsOpts[request any, response any](methods ...Method) EndPointOptions[request, response]
WithAllowedMethodsOpts sets the allowed methods for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithAllowedMethodsOpts[request, response](http.GET, http.POST, http.PUT, http.DELETE, http.PATCH), )
func WithChainOpts ¶ added in v1.2.9
func WithChainOpts[request any, response any](chain Chain[request, response]) EndPointOptions[request, response]
WithChainOpts sets the chain for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithChainOpts[request, response](chain), )
func WithCookieOpts ¶ added in v1.2.9
func WithCookieOpts[request any, response any](cookies map[string]bool) EndPointOptions[request, response]
WithCookieOpts sets the cookies for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithCookieOpts[request, response](cookies), )
func WithHeaderOpts ¶ added in v1.2.9
func WithHeaderOpts[request any, response any](headers map[string]bool) EndPointOptions[request, response]
WithHeaderOpts sets the headers for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithHeaderOpts[request, response](headers), )
func WithParamOpts ¶ added in v1.2.9
func WithParamOpts[request any, response any](params map[string]bool) EndPointOptions[request, response]
WithParamOpts sets the params for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithParamOpts[request, response](params), )
func WithQueryOpts ¶ added in v1.2.9
func WithQueryOpts[request any, response any](queries map[string]bool) EndPointOptions[request, response]
WithQueryOpts sets the queries for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithQueryOpts[request, response](queries), )
func WithRequestProcessorOpts ¶ added in v1.2.9
func WithRequestProcessorOpts[request any, response any](processor RequestProcessor[request]) EndPointOptions[request, response]
WithRequestProcessorOpts sets the request processor for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithRequestProcessorOpts[request, response](processor), )
func WithResponseProcessorOpts ¶ added in v1.2.9
func WithResponseProcessorOpts[request any, response any](processor ResponseProcessor[response]) EndPointOptions[request, response]
WithResponseProcessorOpts sets the response processor for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithResponseProcessorOpts[request, response](processor), )
func WithRouterOpts ¶ added in v1.2.9
func WithRouterOpts[request any, response any](router Router) EndPointOptions[request, response]
WithRouterOpts sets the router for EndPoint, nil is allowed, but it will not work. example:
ep := NewEndPointWithOpts[request, response]( WithRouterOpts[request, response](router), )
type Engine ¶ added in v1.2.9
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AddEndPoints ¶ added in v1.2.9
func (e *Engine) AddEndPoints(eps ...EndPointInterface)
func (*Engine) AddMiddlewares ¶ added in v1.2.9
func (e *Engine) AddMiddlewares(middleware ...gin.HandlerFunc)
func (*Engine) BaseRouter ¶ added in v1.2.9
func (*Engine) ServeAsync ¶ added in v1.2.9
type Handler ¶ added in v1.2.9
func EmptyHandler ¶ added in v1.2.9
EmptyHandler return an empty handler. example:
chain := NewChain[request, response](
EmptyHandler[request, response](),
func(ctx Context[request, response]) {
// do something
ctx.Next()
},
)
type MethodCode ¶ added in v1.2.9
type MethodCode = int32
const ( CodeGet MethodCode = 1 << iota CodePost CodeOptions CodeHead CodePut CodeDelete CodeTrace CodeConnect CodePatch )
type MethodNotAllowedError ¶ added in v1.2.9
type MethodNotAllowedError struct {
Method string
}
func (MethodNotAllowedError) Error ¶ added in v1.2.9
func (e MethodNotAllowedError) Error() string
type NecessaryCookieMissingError ¶ added in v1.2.9
type NecessaryCookieMissingError struct {
Cookie string
}
func (NecessaryCookieMissingError) Error ¶ added in v1.2.9
func (e NecessaryCookieMissingError) Error() string
type NecessaryHeaderMissingError ¶ added in v1.2.9
type NecessaryHeaderMissingError struct {
Header string
}
func (NecessaryHeaderMissingError) Error ¶ added in v1.2.9
func (e NecessaryHeaderMissingError) Error() string
type NecessaryQueryMissingError ¶ added in v1.2.9
type NecessaryQueryMissingError struct {
Query string
}
func (NecessaryQueryMissingError) Error ¶ added in v1.2.9
func (e NecessaryQueryMissingError) Error() string
type Request ¶
type Request interface {
SetUrl(path string) Request
SetMethod(method string) Request
SetBearerToken(token string) Request
SetUserAgent(userAgent string) Request
SetAccept(accept string) Request
SetHeader(key, value string) Request
SetJsonBody(ptr any) Request
SetMultiPartBodyWithErrorHandler(multipartField, multipartName string, multiWriter io.Reader, others map[string]string, handler func(err error) (ignore bool)) Request
SetMultiPartBody(multipartField, multipartName string, multiWriter io.Reader, others map[string]string) Request
SetCookie(cookieKey, cookieValue string) Request
// contains filtered or unexported methods
}
func NewGetRequest ¶
func NewPostRequest ¶
func NewRequest ¶
func NewRequest() Request
type RequestHeader ¶ added in v1.2.9
type RequestProcessor ¶ added in v1.2.9
type Response ¶
type Response interface {
Error() error
Result() (status int, body []byte, err error)
StringResult() (status int, body string, err error)
BindJsonResult(receiver any) (status int, err error)
BindXmlResult(receiver any) (status int, err error)
GetHeader(key string, defaultVal ...string) (val string)
GetBearerToken() (token string)
GetCookie(cookieName string) (ck *http.Cookie)
GetStatusCode() int
GetBody() (body []byte)
BindJsonBody(receiver any) (err error)
BindXmlBody(receiver any) (err error)
}
type ResponseProcessor ¶ added in v1.2.9
type ServerAlreadyServingError ¶ added in v1.2.9
type ServerAlreadyServingError struct {
Address string
}
func (ServerAlreadyServingError) Error ¶ added in v1.2.9
func (e ServerAlreadyServingError) Error() string
type Status ¶ added in v1.2.3
type Status = int
const ( StatusContinue Status = 100 StatusSwitchingProtocols Status = 101 StatusProcessing Status = 102 StatusEarlyHints Status = 103 StatusOK Status = 200 StatusCreated Status = 201 StatusAccepted Status = 202 StatusNonAuthoritative Status = 203 StatusNoContent Status = 204 StatusResetContent Status = 205 StatusPartialContent Status = 206 StatusMultiStatus Status = 207 StatusAlreadyReported Status = 208 StatusIMUsed Status = 226 StatusMultipleChoices Status = 300 StatusMovedPermanently Status = 301 StatusFound Status = 302 StatusSeeOther Status = 303 StatusNotModified Status = 304 StatusUseProxy Status = 305 StatusTemporaryRedirect Status = 307 StatusPermanentRedirect Status = 308 StatusBadRequest Status = 400 StatusPaymentRequired Status = 402 StatusForbidden Status = 403 StatusNotFound Status = 404 StatusMethodNotAllowed Status = 405 StatusNotAcceptable Status = 406 StatusProxyAuthRequired Status = 407 StatusRequestTimeout Status = 408 StatusConflict Status = 409 StatusGone Status = 410 StatusLengthRequired Status = 411 StatusPreconditionFailed Status = 412 StatusRequestEntityToo Status = 413 StatusRequestURITooLong Status = 414 StatusUnsupportedMedia Status = 415 StatusRequestedRangeNot Status = 416 StatusExpectationFailed Status = 417 StatusTeapot Status = 418 StatusMisdirectedRequest Status = 421 StatusUnprocessable Status = 422 StatusLocked Status = 423 StatusFailedDependency Status = 424 StatusTooEarly Status = 425 StatusUpgradeRequired Status = 426 StatusPreconditionRequired Status = 428 StatusTooManyRequests Status = 429 StatusRequestHeaderFields Status = 431 StatusInternalServerError Status = 500 StatusNotImplemented Status = 501 StatusBadGateway Status = 502 StatusGatewayTimeout Status = 504 StatusHTTPVersionNot Status = 505 StatusVariantAlsoNegotiates Status = 506 StatusInsufficientStorage Status = 507 StatusLoopDetected Status = 508 StatusNotExtended Status = 510 StatusNetworkAuthentication Status = 511 )
type UnsupportedAcceptError ¶ added in v1.2.9
type UnsupportedAcceptError struct {
Accept string
}
func (UnsupportedAcceptError) Error ¶ added in v1.2.9
func (e UnsupportedAcceptError) Error() string
type UnsupportedContentTypeError ¶ added in v1.2.9
type UnsupportedContentTypeError struct {
ContentType string
}
func (UnsupportedContentTypeError) Error ¶ added in v1.2.9
func (e UnsupportedContentTypeError) Error() string
type UnsupportedMethodError ¶ added in v1.2.9
type UnsupportedMethodError struct {
Method string
}
func (UnsupportedMethodError) Error ¶ added in v1.2.9
func (e UnsupportedMethodError) Error() string
type UserAgent ¶
type UserAgent = string
const ( Curl UserAgent = "curl/7.64.1" Postman UserAgent = "PostmanRuntime/7.26.8" ChromeOSX UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" Safari UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15" Firefox UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/119.0" )