Documentation ¶
Index ¶
Constants ¶
View Source
const ( BodyTypeForm = "form" BodyTypeJSON = "json" BodyTypeXML = "xml" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SimpleClient ¶
SimpleClient provides a simple interface to making HTTP requests using `net/http`.
func NewSimpleClient ¶
func NewSimpleClient(httpClient *http.Client, baseURL string) SimpleClient
func (*SimpleClient) Do ¶
func (sc *SimpleClient) Do(req SimpleRequest) (*http.Response, error)
func (*SimpleClient) DoUnmarshalJSON ¶ added in v0.45.0
func (sc *SimpleClient) DoUnmarshalJSON(req SimpleRequest, resBody any) ([]byte, *http.Response, error)
type SimpleRequest ¶
type SimpleRequest struct { Method string URL string Query map[string][]string Headers map[string][]string Body any BodyType string AddXMLDocType bool // only used if `Body` is a struct. }
func (*SimpleRequest) BodyBytes ¶
func (req *SimpleRequest) BodyBytes() ([]byte, error)
func (*SimpleRequest) Inflate ¶
func (req *SimpleRequest) Inflate()
Click to show internal directories.
Click to hide internal directories.