Documentation ¶
Index ¶
- Constants
- func Version() string
- type SimpleRequest
- func (sr *SimpleRequest) Accept(accept string)
- func (sr *SimpleRequest) Agent(agent string)
- func (sr *SimpleRequest) Byterange(limit string)
- func (sr *SimpleRequest) Do() (SimpleResponse, error)
- func (sr *SimpleRequest) NoRedirect(redirect bool)
- func (sr *SimpleRequest) Timeout(duration time.Duration)
- type SimpleResponse
Constants ¶
const GET = http.MethodGet
GET whole or partial response from URL
const HEAD = http.MethodHead
HEAD is used to fetch headers only from URL
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SimpleRequest ¶
type SimpleRequest struct { Method string // Method to use to query the URL URL *url.URL // URL we're requesting // contains filtered or unexported fields }
SimpleRequest structure to be turned into a HTTP request proper
func Create ¶
func Create(method string, reqURL string) (SimpleRequest, error)
Create is a mechanism to make a suitable http request header to find some information out about a web resouse.
func Default ¶
func Default(reqURL *url.URL) SimpleRequest
Default will create a default object to make work easier for all.
func (*SimpleRequest) Accept ¶
func (sr *SimpleRequest) Accept(accept string)
Accept allows us to control the response sent back
func (*SimpleRequest) Agent ¶
func (sr *SimpleRequest) Agent(agent string)
Agent is used to supply a user agent name to the request useful to distinguish a spam request, or mock another client
func (*SimpleRequest) Byterange ¶
func (sr *SimpleRequest) Byterange(limit string)
Byterange is used to enable partial download of content for a GET request
func (*SimpleRequest) Do ¶
func (sr *SimpleRequest) Do() (SimpleResponse, error)
Do will perform the request for us from the SimpleRequest object itself.
func (*SimpleRequest) NoRedirect ¶
func (sr *SimpleRequest) NoRedirect(redirect bool)
NoRedirect tells the client whether or not to follow redirects...
func (*SimpleRequest) Timeout ¶
func (sr *SimpleRequest) Timeout(duration time.Duration)
Timeout sets the client timeout in seconds...
type SimpleResponse ¶
type SimpleResponse struct { Data string // The payload from the response Header http.Header // The header from the response PrettyResponse string // Pretty printed response PrettyRequest string // Pretty printed request StatusText string // Status text from the response StatusCode int // Status code from the response Location *url.URL // Location pointed to bu resource }
SimpleResponse to wrap useful components of a HTTP response
func (*SimpleResponse) GetHeader ¶
func (sr *SimpleResponse) GetHeader(key string) string
GetHeader can be used to retrieve headers from the server's response