Documentation
¶
Index ¶
- func DoJSON[R any](c *http.Client, req *http.Request) (res *R, err error)
- func JSON[R any](ctx context.Context, c *http.Client, method, url string, data any) (res *R, err error)
- func NewJSONRequest(ctx context.Context, method, url string, data any) (res *http.Request, err error)
- func RawJSON(ctx context.Context, c *http.Client, method, url string, data any) (res *http.Response, err error)
- func RespJSON[R any](r *http.Response) (res *R, err error)
- type ErrorResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSON ¶
func JSON[R any](ctx context.Context, c *http.Client, method, url string, data any, ) (res *R, err error)
JSON performs the request with the data marshaled to JSON format and unmarshals the response body into a new R.
func NewJSONRequest ¶
func NewJSONRequest(ctx context.Context, method, url string, data any, ) (res *http.Request, err error)
NewJSONRequest returns a new http.Request with the given data marshaled to JSON format.
Types ¶
type ErrorResp ¶ added in v0.3.0
ErrorResp is the error response.
Click to show internal directories.
Click to hide internal directories.