{"modulePath":"github.com/lcnascimento/go-kit/http","version":"v1.6.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package util\n\n## Variables\n\n```go\nvar (\n\tErrParseRequestBody     = errors.New(\"failed to parse request body\").WithCode(\"ERR_PARSE_REQUEST_BODY\").WithKind(errors.KindInvalidInput)\n\tErrMissingCorrelationID = errors.New(\"missing correlation id parameter\").WithCode(\"ERR_MISSING_CORRELATION_ID\").WithKind(errors.KindInvalidInput)\n)\n```\n\n## Functions\n\n```go\nfunc WriteError(ctx context.Context, rw http.ResponseWriter, err error)\n```\n\n```go\nfunc WriteID(rw http.ResponseWriter, status int, id string)\n```\n\n```go\nfunc WriteMessage(rw http.ResponseWriter, status int, msg string)\n```\n\n```go\nfunc WriteResponse(rw http.ResponseWriter, status int, response any)\n```\n\n## Types\n\n```go\ntype APIError struct {\n\tCode      string         `example:\"ERR_SOMETHING_WENT_WRONG\" json:\"code\"`\n\tMessage   string         `example:\"Something went wrong\"     json:\"message\"`\n\tRetryable bool           `example:\"true\"                     json:\"retryable\"`\n\tDetails   map[string]any `json:\"details,omitempty\"`\n}\n```\n\n```go\nfunc NewAPIError(err error) *APIError\n```\n\n```go\nfunc (e *APIError) Error() string\n```\n\n","path":"github.com/lcnascimento/go-kit/http/httpserver/util","name":"util","synopsis":"","isRedistributable":true}
