Documentation ¶
Index ¶
Constants ¶
const ( SchemeHttp = Scheme("http://") SchemeHttps = Scheme("https://") )
Variables ¶
This section is empty.
Functions ¶
func EmptyJsonResponse ¶
func EmptyJsonResponse(w http.ResponseWriter, respCode int)
Write an empty JSON Response to w. RespCode is provided as the response code.
Types ¶
type Client ¶
type Client interface { // Execute req and return the response. An optional error is returned if execution of the request failed for whatever reason. // Note that a non 200 status code will NOT NECESSARILY return an error. Do(req *http.Request) (*http.Response, error) }
Client is an interface used for issuing HTTP requests. It allows for a modular http client making testing easier. Due to the way Go interfaces are resolved, A net/http.Client satisfies this interface. This interface should be used anywhere an http client is needed to facilitate flexibility and ease of testing.
type DirectedClient ¶
DirectedClient is a wrapper around a client and a director for convenience.
func (*DirectedClient) IssueRequest ¶
IssueRequest directs a request and executes it, returning the response object and an optional error if something went wrong.
type Director ¶
func RoundRobin ¶
type LoggedHandler ¶
A loggedHandler is an http.Handler implementation that logs the request using the current logger before servicing the request.
After servicing the request, the response is logged using the same logger, before the response is ultimately sent to the downstream client.
func (LoggedHandler) ServeHTTP ¶
func (h LoggedHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)