Documentation ¶
Index ¶
- Variables
- func AddSignature(r *http.Request, created time.Time, keyID string, secret, payload []byte)
- func AddTracerToDefaultClient(tracerProvider trace.TracerProvider)
- func CreateClient(timeout time.Duration, onRedirect func(*http.Request, []*http.Request) error) *http.Client
- func DiscardBody(body io.ReadCloser) error
- func Do(req *http.Request) (*http.Response, error)
- func DoWithClient(client *http.Client, req *http.Request) (*http.Response, error)
- func ReadBodyRequest(r *http.Request) ([]byte, error)
- func ReadBodyResponse(r *http.Response) ([]byte, error)
- func ValidateSignature(r *http.Request, secret []byte) (bool, error)
- type Request
- func (r Request) Accept(accept string) Request
- func (r Request) AcceptJSON() Request
- func (r Request) BasicAuth(username, password string) Request
- func (r Request) Build(ctx context.Context, payload io.ReadCloser) (*http.Request, error)
- func (r Request) ContentForm() Request
- func (r Request) ContentJSON() Request
- func (r Request) ContentLength(contentLength int64) Request
- func (r Request) ContentType(contentType string) Request
- func (r Request) Delete(url string) Request
- func (r Request) Form(ctx context.Context, data url.Values) (*http.Response, error)
- func (r Request) Get(url string) Request
- func (r Request) Header(name, value string) Request
- func (r Request) IsZero() bool
- func (r Request) JSON(ctx context.Context, body any) (*http.Response, error)
- func (r Request) Method(method string) Request
- func (r Request) MethodURL(method, url string) Request
- func (r Request) Multipart(ctx context.Context, feed func(mw *multipart.Writer) error) (*http.Response, error)
- func (r Request) Patch(url string) Request
- func (r Request) Path(path string, a ...any) Request
- func (r Request) Post(url string) Request
- func (r Request) Put(url string) Request
- func (r Request) Send(ctx context.Context, payload io.ReadCloser) (*http.Response, error)
- func (r Request) StreamJSON(ctx context.Context, body any) (*http.Response, error)
- func (r Request) String() string
- func (r Request) URL(url string) Request
- func (r Request) WithClient(client *http.Client) Request
- func (r Request) WithSignatureAuthorization(keyID string, secret []byte) Request
Constants ¶
This section is empty.
Variables ¶
View Source
var NoRedirection = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }
Functions ¶
func AddSignature ¶ added in v4.20.0
AddSignature add Authorization header based on content signature based on https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12
func AddTracerToDefaultClient ¶ added in v4.36.0
func AddTracerToDefaultClient(tracerProvider trace.TracerProvider)
func CreateClient ¶ added in v4.28.1
func DiscardBody ¶ added in v4.22.3
func DiscardBody(body io.ReadCloser) error
func DoWithClient ¶
func ValidateSignature ¶ added in v4.20.0
ValidateSignature check Authorization header based on content based on https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12
Types ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (Request) AcceptJSON ¶ added in v4.39.2
func (Request) ContentForm ¶
func (Request) ContentJSON ¶
func (Request) ContentLength ¶ added in v4.46.2
func (Request) ContentType ¶
func (Request) StreamJSON ¶ added in v4.39.2
Click to show internal directories.
Click to hide internal directories.