httputil

package
v0.0.0-...-7b7c10a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 6 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 WithAuthToken

func WithAuthToken(token string) Opt

WithAuthToken specifies an authorization token.

func WithBody

func WithBody(val []byte) Opt

WithBody specifies HTTP request body.

func WithHTTPClient

func WithHTTPClient(c httpClient) Opt

WithHTTPClient specifies the custom HTTP client.

func WithMethod

func WithMethod(val string) Opt

WithMethod specifies an HTTP method. Default is GET.

type Response

type Response struct {
	StatusCode int
	Body       []byte
}

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