Documentation ¶
Overview ¶
methods in this package automatically include a context with a timeout, in order to solve the problem of hanging requests and to avoid goroutine leaks
Index ¶
- func Delete(url string, body []byte, timeout time.Duration) (*http.Response, error)
- func Do(requestFunc func(ctx context.Context) (*http.Request, error), ...) (*http.Response, error)
- func Get(url string, timeout time.Duration) (*http.Response, error)
- func GetWithHeader(url string, timeout time.Duration, header map[string]string) (*http.Response, error)
- func Post(url string, body []byte, timeout time.Duration) (*http.Response, error)
- func PostWithHeader(url string, body []byte, timeout time.Duration, header map[string]string) (*http.Response, error)
- func Put(url string, body []byte, timeout time.Duration) (*http.Response, error)
- func PutByReader(url string, body []byte, timeout time.Duration) (*http.Response, error)
- type HandlerMultiplexer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetWithHeader ¶ added in v0.4.0
func PostWithHeader ¶ added in v0.4.0
func PostWithHeader(url string, body []byte, timeout time.Duration, header map[string]string) (*http.Response, error)
default header "Content-Type: application/json" is included.
Types ¶
type HandlerMultiplexer ¶
func (*HandlerMultiplexer) ServeHTTP ¶
func (h *HandlerMultiplexer) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.