craterhttp

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultClient = NewClient(5 * time.Second)

Functions

This section is empty.

Types

type Client added in v1.5.0

type Client struct {
	DefaultHeaders func(r *Request) map[string][]string
	OnResponse     func(*Response) error
	Timeout        time.Duration
}

func NewClient added in v1.5.0

func NewClient(timeout time.Duration) *Client

func (*Client) Do added in v1.5.0

func (c *Client) Do(r *Request) (*Response, error)

type Decoder

type Decoder interface {
	DecodeResponse(resp io.ReadCloser, dst any) error
}

type Request

type Request = fetch.Request

func NewRequest added in v1.5.0

func NewRequest(method string, url string, body any) (*Request, error)

type RequestFunc

type RequestFunc func(mux.Variables) (*Request, error)

func NewRequestFunc

func NewRequestFunc(method string, url string, body any) RequestFunc

type Response

type Response fetch.Response

func Fetch

func Fetch(r *Request) (*Response, error)

func (*Response) JSON added in v1.5.9

func (r *Response) JSON(dst any) error

func (*Response) String

func (r *Response) String() string

Jump to

Keyboard shortcuts

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