Documentation
¶
Index ¶
- Variables
- type BodyParser
- type Client
- type Mono
- func Delete(url string, opts ...Option) Mono
- func Do(req *http.Request, opts ...Option) Mono
- func Get(url string, opts ...Option) Mono
- func Patch(url string, contentType string, body io.Reader, opts ...Option) Mono
- func Post(url string, contentType string, body io.Reader, opts ...Option) Mono
- func Put(url string, contentType string, body io.Reader, opts ...Option) Mono
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = NewClient(http.DefaultClient)
DefaultClient is the default Client.
Functions ¶
This section is empty.
Types ¶
type BodyParser ¶
type Client ¶
type Client interface { // Do sends an HTTP request and returns a response Mono. Do(req *http.Request, opts ...Option) Mono // Get sends a GET request and returns a response Mono. Get(url string, opts ...Option) Mono // Delete sends a DELETE request and returns a response Mono. Delete(url string, opts ...Option) Mono // Post sends a POST request and returns a response Mono. Post(url string, contentType string, body io.Reader, opts ...Option) Mono // Put sends a PUT request and returns a response Mono. Put(url string, contentType string, body io.Reader, opts ...Option) Mono // Patch sends a PATCH request and returns a response Mono. Patch(url string, contentType string, body io.Reader, opts ...Option) Mono }
Client is a reactor style http client which returns a Mono.
type Mono ¶
Mono is alias of mono.Mono.
type Option ¶
type Option func(*option)
Option is the type of http client options.
func WithJSONResponse ¶
func WithJSONResponse(gen func() (ptr interface{})) Option
WithJSONResponse decodes the response body as json.
func WithRequestHijack ¶
WithRequestHijack can be used to customize the http request.
func WithResponseBodyParser ¶
func WithResponseBodyParser(bp BodyParser) Option
WithResponseBodyParser set the response body parser.
func WithStringResponse ¶
func WithStringResponse() Option
WithStringResponse decodes the response body as string.
Click to show internal directories.
Click to hide internal directories.