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)
- type Client
- type ReverseProxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchToFile ¶
FetchToFile downloads the file from the given `url` into the specified `dst` file.
func ResponseReader ¶
func ResponseReader(resp *http.Response) (io.ReadCloser, error)
Types ¶
type Client ¶ added in v0.73.15
Client is an HTTP client.
func NewClient ¶ added in v0.73.15
func NewClient(credsSource *cliconfig.CredentialsSource) *Client
type ReverseProxy ¶ added in v0.73.15
type ReverseProxy struct { ServerURL *url.URL CredsSource *cliconfig.CredentialsSource Rewrite func(*httputil.ProxyRequest) ModifyResponse func(resp *http.Response) error ErrorHandler func(http.ResponseWriter, *http.Request, error) Logger log.Logger }
func (*ReverseProxy) NewRequest ¶ added in v0.73.15
func (reverseProxy *ReverseProxy) NewRequest(ctx echo.Context, targetURL *url.URL) (er error)
func (ReverseProxy) WithModifyResponse ¶ added in v0.73.15
func (reverseProxy ReverseProxy) WithModifyResponse(fn func(resp *http.Response) error) *ReverseProxy
func (ReverseProxy) WithRewrite ¶ added in v0.73.15
func (reverseProxy ReverseProxy) WithRewrite(fn func(req *httputil.ProxyRequest)) *ReverseProxy
Click to show internal directories.
Click to hide internal directories.