Documentation
¶
Overview ¶
Package helpers provides utility functions for working with HTTP requests and responses.
Index ¶
- func DecodeJSONBody(resp *http.Response, value any) error
- func Fetch(ctx context.Context, req *http.Request, dst io.Writer) error
- func FetchToFile(ctx context.Context, req *http.Request, dst string) error
- func ModifyJSONBody(resp *http.Response, value any, fn func() error) error
- func ResponseBuffer(resp *http.Response) (*bytes.Buffer, error)
- func ResponseReader(resp *http.Response) (io.ReadCloser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeJSONBody ¶
func DecodeJSONBody(resp *http.Response, value any) error
func FetchToFile ¶
func FetchToFile(ctx context.Context, req *http.Request, dst string) error
FetchToFile downloads the file from the given `url` into the specified `dst` file.
func ModifyJSONBody ¶
func ModifyJSONBody(resp *http.Response, value any, fn func() error) error
func ResponseBuffer ¶
func ResponseBuffer(resp *http.Response) (*bytes.Buffer, error)
func ResponseReader ¶
func ResponseReader(resp *http.Response) (io.ReadCloser, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.