Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTP ¶
func NewHTTP(ctx context.Context, method, url string, body io.Reader, opts ...Option) (*http.Request, error)
NewHTTP creates a new HTTP request from the provided parameters and returns it. If the passed in context is nil, it creates a new background context. If the provided body is nil, it gets initialized to bytes.Reader. By default the following headers are set: * Accept: application/json; charset=utf-8 If no Content-Type has been set via options it defaults to application/json.
Types ¶
type Option ¶
Option is http request functional option.
func WithAddHeader ¶
WithAddHeader adds the val to key header.
func WithBearer ¶
WithBearer sets the Authorization header to the provided Bearer token.
func WithSetHeader ¶
WithSetHeader sets the header key to value val.
Click to show internal directories.
Click to hide internal directories.