Documentation
¶
Index ¶
- func SendHTTPRequest(req *http.Request, httpClient HTTPClient, status int, logger *log.Log) ([]byte, http.Header, error)
- func WriteErrorResponsef(rw http.ResponseWriter, logger logger, status int, msg string, ...)
- func WriteResponse(rw http.ResponseWriter, l logger, v interface{})
- type ErrorResponse
- type HTTPClient
- type HTTPHandler
- type Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendHTTPRequest ¶
func SendHTTPRequest(req *http.Request, httpClient HTTPClient, status int, logger *log.Log) ([]byte, http.Header, error)
SendHTTPRequest sends an http request to the client, expecting a given status, and returning the result.
func WriteErrorResponsef ¶
func WriteErrorResponsef(rw http.ResponseWriter, logger logger, status int, msg string, args ...interface{})
WriteErrorResponsef write error resp.
func WriteResponse ¶
func WriteResponse(rw http.ResponseWriter, l logger, v interface{})
WriteResponse writes interface value to response.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"errMessage,omitempty"`
}
ErrorResponse to send error message in the response.
type HTTPClient ¶
HTTPClient http client interface.
type HTTPHandler ¶
type HTTPHandler struct {
// contains filtered or unexported fields
}
HTTPHandler contains REST API handling details which can be used to build routers for the given path.
func NewHTTPHandler ¶
func NewHTTPHandler(path, method string, handle http.HandlerFunc) *HTTPHandler
NewHTTPHandler returns instance of HTTPHandler which can be used to handle http requests.
func (*HTTPHandler) Handle ¶
func (h *HTTPHandler) Handle() http.HandlerFunc
Handle returns http request handle func.
func (*HTTPHandler) Method ¶
func (h *HTTPHandler) Method() string
Method returns http request method type.
Click to show internal directories.
Click to hide internal directories.