Documentation ¶
Index ¶
- Constants
- Variables
- func NewRestClient(options ...microClient.Option) microClient.Client
- type Client
- func (c *Client) Call(ctx context.Context, addr string, req *microClient.Request, rsp interface{}, ...) error
- func (c *Client) Do(req *Request, resp *Response) error
- func (c *Client) Init(opts ...microClient.Option) error
- func (c *Client) NewRequest(service, schemaID, operationID string, arg interface{}, ...) *microClient.Request
- func (c *Client) Options() microClient.Options
- func (c *Client) String() string
- type Request
- func (req *Request) Close()
- func (req *Request) Copy() *Request
- func (req *Request) GetHeader(key string) string
- func (req *Request) GetMethod() string
- func (req *Request) GetRequest() *fasthttp.Request
- func (req *Request) GetURI() string
- func (req *Request) SetBody(body []byte)
- func (req *Request) SetHeader(key, value string)
- func (req *Request) SetHeaderCookie(key, value string)
- func (req *Request) SetMethod(method string)
- func (req *Request) SetURI(url string)
- type Response
- func (resp *Response) Close()
- func (resp *Response) GetCookie(key string) []byte
- func (resp *Response) GetHeader() []byte
- func (resp *Response) GetResponse() *fasthttp.Response
- func (resp *Response) GetStatusCode() int
- func (resp *Response) ReadBody() []byte
- func (resp *Response) SetCookie(cookie *fasthttp.Cookie)
- func (resp *Response) SetStatusCode(s int)
Constants ¶
View Source
const ( // Name is a constant of type string Name = "rest" // FailureTypePrefix is a constant of type string FailureTypePrefix = "http_" )
Variables ¶
View Source
var HTTPFailureTypeMap = map[string]bool{ FailureTypePrefix + strconv.Itoa(http.StatusInternalServerError): true, FailureTypePrefix + strconv.Itoa(http.StatusBadGateway): true, FailureTypePrefix + strconv.Itoa(http.StatusServiceUnavailable): true, FailureTypePrefix + strconv.Itoa(http.StatusGatewayTimeout): true, FailureTypePrefix + strconv.Itoa(http.StatusTooManyRequests): true, }
HTTPFailureTypeMap is a variable of type map
Functions ¶
func NewRestClient ¶
func NewRestClient(options ...microClient.Option) microClient.Client
NewRestClient is a function
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a struct
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, addr string, req *microClient.Request, rsp interface{}, opts ...microClient.CallOption) error
Call is a method which uses client struct object
func (*Client) NewRequest ¶
func (c *Client) NewRequest(service, schemaID, operationID string, arg interface{}, reqOpts ...microClient.RequestOption) *microClient.Request
NewRequest do not use for rest client.
func (*Client) Options ¶
func (c *Client) Options() microClient.Options
Options is a method which used client struct object
type Request ¶
Request is struct
func NewRequest ¶
NewRequest is a function which creates new request
func (*Request) GetRequest ¶
GetRequest is a method
func (*Request) SetHeaderCookie ¶
SetHeaderCookie is a method used to setting header cookie
type Response ¶
Response is a struct used for handling response
func (*Response) GetResponse ¶
GetResponse is a method used to get response
func (*Response) GetStatusCode ¶
GetStatusCode returns response status code.
func (*Response) SetStatusCode ¶
SetStatusCode sets the status code
Click to show internal directories.
Click to hide internal directories.