Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Do(req *Req) (*Resp, error)
- func (c *Client) Get(url string) (*Resp, error)
- func (c *Client) GetJson(url string, to interface{}) (*Resp, error)
- func (c *Client) PostWithJson(url string, data interface{}) (*Resp, error)
- func (c *Client) PostWithJsonBind(url string, data interface{}, to interface{}) (*Resp, error)
- type ClientCfg
- type CookieCfg
- type Params
- type Req
- type Resp
- type ServeMux
- type Server
- type ServerCfg
Constants ¶
View Source
const ( GetMethod method = "GET" PostMethod method = "POST" PutMethod method = "PUT" DeleteMethod method = "DELETE" OptionsMethod method = "OPTIONS" HeadMethod method = "HEAD" TraceMethod method = "TRACE" ConnectMethod method = "CONNECT" JsonType contentType = "application/json" XmlType contentType = "application/xml" TextType contentType = "text/plain" HtmlType contentType = "text/html" )
View Source
const ( StatusContinue = 100 StatusSwitchingProtocols = 101 StatusProcessing = 102 StatusEarlyHints = 103 StatusOK = 200 StatusCreated = 201 StatusAccepted = 202 StatusNonAuthoritativeInfo = 203 StatusNoContent = 204 StatusResetContent = 205 StatusPartialContent = 206 StatusMultiStatus = 207 StatusAlreadyReported = 208 StatusIMUsed = 226 StatusMultipleChoices = 300 StatusMovedPermanently = 301 StatusFound = 302 StatusSeeOther = 303 StatusNotModified = 304 StatusUseProxy = 305 StatusTemporaryRedirect = 307 StatusPermanentRedirect = 308 StatusBadRequest = 400 StatusPaymentRequired = 402 StatusForbidden = 403 StatusNotFound = 404 StatusMethodNotAllowed = 405 StatusNotAcceptable = 406 StatusProxyAuthRequired = 407 StatusRequestTimeout = 408 StatusConflict = 409 StatusGone = 410 StatusLengthRequired = 411 StatusPreconditionFailed = 412 StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusRequestedRangeNotSatisfiable = 416 StatusExpectationFailed = 417 StatusTeapot = 418 StatusMisdirectedRequest = 421 StatusUnprocessableEntity = 422 StatusLocked = 423 StatusFailedDependency = 424 StatusTooEarly = 425 StatusUpgradeRequired = 426 StatusPreconditionRequired = 428 StatusTooManyRequests = 429 StatusRequestHeaderFieldsTooLarge = 431 StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusGatewayTimeout = 504 StatusHTTPVersionNotSupported = 505 StatusVariantAlsoNegotiates = 506 StatusInsufficientStorage = 507 StatusLoopDetected = 508 StatusNotExtended = 510 StatusNetworkAuthenticationRequired = 511 )
Variables ¶
View Source
var DefaultClient = NewClient(&ClientCfg{Prefix: "", Timeout: 5 * time.Second})
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) PostWithJson ¶
type ServerCfg ¶
type ServerCfg struct { Url string `yaml:"url" env:"SERVER_URL" env-default:":80"` ReadTimeout time.Duration `yaml:"readTimeout" env:"SERVER_READ_TIMEOUT" env-default:"5s"` WriteTimeout time.Duration `yaml:"writeTimeout" env:"SERVER_WRITE_TIMEOUT" env-default:"5s"` ShutdownTimeout time.Duration `yaml:"shutdownTimeout" env:"SERVER_SHUTDOWN_TIMEOUT" env-default:"5s"` }
Config is type for server setup.
Click to show internal directories.
Click to hide internal directories.