Documentation ¶
Index ¶
- func DefaultHTTPRequestProvider(method, url string, body io.Reader) (*http.Request, error)
- func RequestLogger(label string, h http.Handler) http.Handler
- func RespondWithBody(w http.ResponseWriter, events subscribed.Events, httpCode int)
- func RespondWithErrorAndLog(e error, w http.ResponseWriter)
- type HTTPClient
- type HTTPClientProvider
- type HTTPRequestProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHTTPRequestProvider ¶
DefaultHTTPRequestProvider returns a default http.Request with the given method, url and body
func RequestLogger ¶
RequestLogger creates an http.Handler function with a default info logger
func RespondWithBody ¶
func RespondWithBody(w http.ResponseWriter, events subscribed.Events, httpCode int)
RespondWithBody sends http response with json body
func RespondWithErrorAndLog ¶
func RespondWithErrorAndLog(e error, w http.ResponseWriter)
RespondWithErrorAndLog logs error and sends http response with error json body
Types ¶
type HTTPClient ¶
An HTTPClient represents an interface type of HTTPClient that encapsulates a 'Do' function which takes an http.Request and returns an http.Response
func DefaultHTTPClientProvider ¶
func DefaultHTTPClientProvider() HTTPClient
DefaultHTTPClientProvider returns a default HTTPClient implementation
type HTTPClientProvider ¶
type HTTPClientProvider func() HTTPClient
An HTTPClientProvider represents a function type that returns an HTTPClient
Click to show internal directories.
Click to hide internal directories.