Documentation ¶
Index ¶
Constants ¶
const TRACE_BUFFER_SIZE = 10_000
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HTTPResponse ¶
Use rest.HTTPError as an HTTP response. Even though its name suggests that it represents an error, HTTPError has all of the elements needed to encapsulate a response.
func EnsureJSONEncodedRequestBody ¶
func EnsureJSONEncodedRequestBody(request *http.Request) *HTTPResponse
Ensures the request body is JSON-encoded. If it is not, returns an HTTPResponse indicating an error. Otherwise, returns nil.
func NewHTTPError ¶
func NewHTTPError(err error, status int, message string) HTTPResponse
Convenience method for creating HTTPResponses that represent errors. If the given error is a rest.HTTPError, then this is used as is, and the remaining arguments are ignored.
func NewHTTPResponse ¶
func NewHTTPResponse(status int, body interface{}) HTTPResponse
HTTPResponse constructor. If the given body cannot be serialized into JSON, this produces a status-500 response with an empty body, and an error is logged.
func (*HTTPResponse) ResponseBody ¶
func (response *HTTPResponse) ResponseBody() []byte
Obtains the JSON body of an HTTP response.
func (*HTTPResponse) ResponseHeaders ¶
func (response *HTTPResponse) ResponseHeaders() (int, map[string]string)
Produces the response code and a set of headers for an HTTP response.
func (*HTTPResponse) Write ¶
func (response *HTTPResponse) Write(writer http.ResponseWriter)
Writes an HTTP response to the network.
type TraceEvent ¶ added in v0.14.0
type TraceEvent = har_loader.CustomHAREntry