Documentation
¶
Index ¶
- Variables
- func AuthBearerHeader(token string) http.Header
- func AuthHeader(v string) http.Header
- func ContentHeader(v string) http.Header
- func Header(k, v string) http.Header
- type BodyMarshaler
- type BodyMarshalerFunc
- type Builder
- func (b Builder) Build(ctx context.Context) (*http.Request, error)
- func (b Builder) WithBody(body any) Builder
- func (b Builder) WithBodyMarshaler(bodyMarshaler BodyMarshaler) Builder
- func (b Builder) WithHeaders(headers ...http.Header) Builder
- func (b Builder) WithMethod(method string) Builder
- func (b Builder) WithParams(params any) Builder
- func (b Builder) WithPath(path string) Builder
- type BuilderOption
- type URLValuesMarshaler
- type URLValuesMarshalerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( JSONContentHeader = ContentHeader("application/json") URLEncodedContentHeader = ContentHeader("application/x-www-form-urlencoded") JSONAcceptHeader = Header("Accept", "application/json") )
Functions ¶
func AuthBearerHeader ¶
func AuthHeader ¶
func ContentHeader ¶
Types ¶
type BodyMarshaler ¶
BodyMarshaler is an interface for marshaling request bodies.
type BodyMarshalerFunc ¶
BodyMarshalerFunc is a function type that implements the BodyMarshaler interface.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is a struct for configuring and building HTTP requests.
func NewBuilder ¶
func NewBuilder(baseURL string, opts ...BuilderOption) Builder
NewBuilder creates a new instance of Builder with the provided base URL and options.
func (Builder) WithBodyMarshaler ¶
func (b Builder) WithBodyMarshaler(bodyMarshaler BodyMarshaler) Builder
WithBodyMarshaler sets the marshaler for the request body.
func (Builder) WithHeaders ¶
WithHeaders sets the request headers.
func (Builder) WithMethod ¶
WithMethod sets the HTTP method for the request.
func (Builder) WithParams ¶
WithParams sets the URL parameters.
type BuilderOption ¶
type BuilderOption interface {
// contains filtered or unexported methods
}
func WithBodyMarshaler ¶
func WithBodyMarshaler(marshaler BodyMarshaler) BuilderOption
func WithURLValuesMarshaler ¶
func WithURLValuesMarshaler(marshaler URLValuesMarshaler) BuilderOption
type URLValuesMarshaler ¶
URLValuesMarshaler is an interface for marshaling URL parameters.
type URLValuesMarshalerFunc ¶
URLValuesMarshalerFunc is a function type that implements the URLValuesMarshaler interface.
Click to show internal directories.
Click to hide internal directories.