http

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithApiHeaderFn

func WithApiHeaderFn(fn ApiHeaderFn) option

WithApiHeaderFn returns an option that sets a function to add API headers to requests

func WithHttpClient

func WithHttpClient(client *http.Client) option

WithHttpClient returns an option that sets the HTTP client used by the Client

Types

type ApiHeaderFn

type ApiHeaderFn func(*http.Request)

ApiHeaderFn is a function type that sets headers on HTTP requests

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an HTTP client that can make API requests with optional headers

func NewClient

func NewClient(opts ...option) *Client

NewClient creates a new Client with the given options

func (*Client) MakeReq

func (c *Client) MakeReq(ctx context.Context, url string) ([]byte, error)

MakeReq makes a GET request to the given URL with the configured client It returns the response body as bytes or an error if the request fails

Jump to

Keyboard shortcuts

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