Documentation ¶
Overview ¶
Package httphelper contains net/http package helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithObject ¶ added in v0.2.0
func WithObject() func(o *HttpErrorOptions)
WithObject turns on HttpError Object reading from a HTTP response body.
Types ¶
type HttpError ¶
type HttpError[O any] struct { StatusCode int `json:"status_code"` Status string `json:"status"` Object O `json:"object,omitempty"` }
HttpError represents a HTTP error. Object (if turned on) is read from a HTTP response body, if any.
func NewHttpError ¶
func NewHttpError[O any](rs *http.Response, opts ...func(o *HttpErrorOptions)) (*HttpError[O], error)
NewHttpError creates HttpError from http.Response.
type HttpErrorOptions ¶ added in v0.2.1
type HttpErrorOptions struct {
// contains filtered or unexported fields
}
HttpErrorOptions contains HttpError options.
Click to show internal directories.
Click to hide internal directories.