requester

package
v0.0.0-...-e105d0e Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeResponse

func DecodeResponse(body io.Reader, v any) error

func DecodeString

func DecodeString(body io.Reader, output *string) error

Types

type Decoder

type Decoder func([]byte, any) error

type Encoder

type Encoder func(any) ([]byte, error)

type HTTPClient

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

HTTPClient represents a client to send HTTP requests.

func NewHTTPClient

func NewHTTPClient(opts ...HTTPOption) *HTTPClient

NewHTTPClient is used to build a new HTTPClient.

func (*HTTPClient) IsFailureStatusCode

func (r *HTTPClient) IsFailureStatusCode(resp *http.Response) bool

func (*HTTPClient) SendRequest

func (c *HTTPClient) SendRequest(req *http.Request, response any, outputResponse bool) (*http.Response, error)

func (*HTTPClient) SendRequestRaw

func (c *HTTPClient) SendRequestRaw(req *http.Request) (*http.Response, error)

type HTTPOption

type HTTPOption func(*HTTPClient)

func WithBefore

func WithBefore(fn func(*http.Request) error) HTTPOption

func WithClient

func WithClient(c *http.Client) HTTPOption

func WithDecoder

func WithDecoder(fn func([]byte, any) error) HTTPOption

func WithEncoder

func WithEncoder(fn func(obj any) ([]byte, error)) HTTPOption

type Stringer

type Stringer interface {
	GetString() *string
}

Jump to

Keyboard shortcuts

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