Documentation
¶
Index ¶
- Variables
- func Connect(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Delete(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Do(ctx context.Context, timeout time.Duration, method string, url string, ...) (*http.Response, error)
- func Get(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Head(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Options(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Patch(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Post(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Put(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- func Trace(ctx context.Context, timeout time.Duration, url string, opts ...Option) (*http.Response, error)
- type Option
- func CheckStatusCode(statusCode ...int) Option
- func ToAnyDecode(v any, newDecoder httpu.NewDecoder) Option
- func ToAnyUnmarshal(v any, unmarshaler func(bs []byte, v any) error) Option
- func ToBytes(n *int, b []byte) Option
- func ToBytesBuffer(n *int64, buf *bytes.Buffer) Option
- func ToJSON(v any) Option
- func ToWriter(n *int64, w io.Writer) Option
- func WithBody(body []byte) Option
- func WithBodyForm(form url.Values) Option
- func WithBodyJSON(v any) Option
- func WithBodyMarshal(v any, contentType string, marshal func(v any) ([]byte, error)) Option
- func WithBodyReader(reader io.Reader) Option
- func WithHeaders(headerKvs ...string) Option
- type ReqOptionFunc
- type RespOptionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRespStatusCodeNotExpected = errors.New("response status code not expected")
)
Functions ¶
Types ¶
type Option ¶ added in v0.9.19
type Option any
Option must implement reqOption or respOption.
func CheckStatusCode ¶ added in v0.9.19
func ToAnyDecode ¶ added in v0.10.4
func ToAnyDecode(v any, newDecoder httpu.NewDecoder) Option
func ToAnyUnmarshal ¶ added in v0.9.19
func WithBodyForm ¶ added in v0.9.19
func WithBodyJSON ¶ added in v0.9.19
func WithBodyMarshal ¶ added in v0.9.19
func WithBodyReader ¶ added in v0.9.19
func WithHeaders ¶ added in v0.9.19
type ReqOptionFunc ¶ added in v0.9.19
type RespOptionFunc ¶ added in v0.9.19
func (RespOptionFunc) HandleResp ¶ added in v0.9.19
func (f RespOptionFunc) HandleResp(r *http.Response) error
Click to show internal directories.
Click to hide internal directories.