httputil

package
v0.0.0-...-e472cc8 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(*options)

Opt configures HTTP request options.

func WithBody

func WithBody(val []byte) Opt

WithBody specifies HTTP request body.

func WithGNAPToken

func WithGNAPToken(token string) Opt

WithGNAPToken specifies an authorization GNAP token.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Opt

WithHTTPClient specifies the custom HTTP client.

func WithMethod

func WithMethod(method string) Opt

WithMethod specifies an HTTP method. Default is GET.

func WithSigner

func WithSigner(signer requestSigner) Opt

WithSigner specifies a request signer for HTTP Signatures.

type Response

type Response struct {
	Status       string
	StatusCode   int
	Body         []byte
	ErrorMessage string
}

Response is an HTTP response.

func DoRequest

func DoRequest(ctx context.Context, url string, opts ...Opt) (*Response, error)

DoRequest makes an HTTP request.

Jump to

Keyboard shortcuts

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