Documentation ¶
Index ¶
- Variables
- func Recover(f func(err error)) any
- type Client
- func (c *Client) Do() (*http.Response, error)
- func (c *Client) OnRecover(f func(err error)) *Client
- func (c *Client) Request(r *http.Request) *Client
- func (c *Client) WithCookie(cookie *http.Cookie) error
- func (c *Client) WithData(formData map[string]string, encoding Encoding, file ...File) error
- func (c *Client) WithHeaders(headers map[string]string) error
- func (c *Client) WithQuery(query map[string]string) error
- type Encoding
- type File
- type Methods
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRequest = "no request has been set" // Error message for when no request has been set ErrNoCallback = "no callback has been set" // Error message for when no callback has been set ErrNoEncoding = "no encoding has been set or is not valid" // Error message for when no encoding has been set )
Define standard error messages
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client that can be used to execute http requests. - Can be used to execute GET, POST, PUT, DELETE, PATCH requests.
func NewClient ¶
func NewClient() *Client
Client is a client that can be used to make requests to a server.
func (*Client) WithCookie ¶
Add a HTTP.Cookie to the request
func (*Client) WithHeaders ¶
Add headers to the request
type File ¶
type File struct { FileName string // Name of the file FieldName string // Name of the field Reader io.Reader // Reader of the file }
Define a type for multipart files
type Methods ¶
type Methods string
Define methods and encodings type
const ( GET Methods = "GET" // GET method POST Methods = "POST" // POST method PUT Methods = "PUT" // PUT method PATCH Methods = "PATCH" // PATCH method DELETE Methods = "DELETE" // DELETE method OPTIONS Methods = "OPTIONS" // OPTIONS method HEAD Methods = "HEAD" // HEAD method TRACE Methods = "TRACE" // TRACE method )
Define request methods
Click to show internal directories.
Click to hide internal directories.