package
1.7.0
Repository: https://github.com/acronis/go-appkit.git
Documentation: pkg.go.dev

# Functions

DecodeRequestJSON tries to read request body and decode it as JSON.
DecodeRequestJSONStrict tries to read and validate request fields in body and decode it as JSON.
DisableWrappingErrorInResponse disables wrapping error ({"error": {"domain": "{domain}", ...} -> {"domain": "{domain}", ...}) in response body.
DoRequest allows to do HTTP requests and log some its details.
DoRequestAndUnmarshalJSON allows doing HTTP requests, log some its details and unmarshal response.
MustInitAndRegisterMetrics initializes and registers restapi global metrics.
NewError creates a new Error with specified params.
NewExcludedRoute returns a new route that will be used as exclusion in matching.
NewInternalError creates a new internal error with specified domain.
NewJSONRequest performs JSON marshaling of the passed data and creates a new http.Request.
NewRoute returns a new route.
NewRoutesManager create new RoutesManager.
NewTooLargeMalformedRequestError creates a new MalformedRequestError for case when request body is too large.
NormalizeURLPath normalizes URL path (i.e.
ParseRoutePath parses string representation of route's path.
RespondCodeAndJSON sends a response with the passed status code and sets the "Content-Type" to "application/json" if it's not already set.
RespondError sets HTTP status code in response and writes error in body in JSON format.
RespondInternalError sends response with 500 HTTP status code and internal error in body in JSON format.
RespondJSON sends response with 200 HTTP status code, does JSON marshaling of data and writes result in response's body.
RespondMalformedRequestError creates Error from passed MalformedRequestError and then call RespondError.
RespondMalformedRequestOrInternalError calls RespondMalformedRequestError (if passed error is *MalformedRequestError) or RespondInternalError (in other cases).
RespondNoWrappedError sets HTTP status code in response and writes non-wrapped error in body in JSON format.
RespondWrappedError sets HTTP status code in response and writes wrapped error in body in JSON format.
SetRequestMaxBodySize wraps request body with a reader which limit the number of bytes to read.
UnregisterMetrics unregisters restapi global metrics.

# Constants

ContentTypeAppJSON represents MIME media type for JSON.
ContentTypeAppSCIMJSON represents MIME media type for SCIM JSON.

# Variables

Error codes.
Error codes.
Error codes.
Error messages.
Error messages.
Error messages.

# Structs

ClientError - error that can be returned in request to client.
Error represents an error details.
ErrorResponseData is used for answer on requests with error.
KBLinkInfo represents an info about item in Acronis Knowledge Base.
MalformedRequestError is an error that occurs in case of incorrect request.
RequestBodyTooLargeError represents an error that occurs when read number of bytes (HTTP request body) exceeds the specified limit.
Route represents route for handling.
RouteConfig represents route's configuration.
RoutePath represents route's path.
RoutesManager contains routes for handling and allows to search among them.