httpclient

package
v0.5.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2023 License: Apache-2.0, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(baseURL, resource string, options ...Option) (*url.URL, *http.Client, error)

New creates a base URL and a new http.Client. The default port is only used if baseURL does not contain a port.

func ReadError

func ReadError(status int, body []byte) error

func ReadErrorFrom

func ReadErrorFrom(status int, r io.Reader) error

Types

type Option

type Option func(*config) error

Option is a function that sets a value in a config.

func WithClient

func WithClient(c *http.Client) Option

WithClient allows creation of the http client using an underlying network round tripper / client.

func WithTimeout added in v0.5.5

func WithTimeout(timeout time.Duration) Option

WithTimeout configures the timeout to wait for a response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL