Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPMethod ¶
type HTTPMethod int
const ( GET HTTPMethod = iota POST PUT DELETE OPTIONS HEAD CONNECT TRACE PATCH )
func (HTTPMethod) String ¶
func (m HTTPMethod) String() string
Convert an HTTPMethod to it's string format
type Request ¶
type Request struct { URL string // URL to send the request to Method HTTPMethod // HTTP method to use Headers map[string]string // Headers to send with the request Body []byte // Body to send with the request Timeout time.Duration // Timeout for the request }
func (*Request) DelHeader ¶
Deletes a header value from the request headers if it exists. Normalizes the key to lowercase before deleting.
func (*Request) GetHeader ¶
Get a header value from the request. Normalizes the key to lowercase before checking. Returns the value of the header and whether it exists.
func (*Request) MustSend ¶
Send the HTTP request and panic if an error is returned. (Calls Send() internally)
type Response ¶
type Response struct { Ok bool // Was the request successful? (Status codes: 200-399) StatusCode int // HTTP response status code Headers map[string]string // HTTP Response headers Body []byte // HTTP Response body }
Click to show internal directories.
Click to hide internal directories.