Documentation
¶
Index ¶
- func BadRequest(message string) error
- func ConvertToInt(value string) (int, error)
- func ConvertToPtrUrlURL(value string) (*url.URL, error)
- func ConvertToString(value string) (string, error)
- func ConvertToUuidUUID(value string) (uuid.UUID, error)
- func ExtractFromCookie(r *http.Request, name string) (string, bool)
- func ExtractFromFile(r *http.Request, name string) (*multipart.FileHeader, bool)
- func ExtractFromForm(r *http.Request, name string) (string, bool)
- func ExtractFromHeader(r *http.Request, name string) (string, bool)
- func ExtractFromPath(r *http.Request, name string) (string, bool)
- func Forbidden(message string) error
- func NotFound() error
- func RespondError(err error, w http.ResponseWriter, r *http.Request)
- func Unauthorized() error
- type BytesValue
- type HttpError
- type JSONValue
- type StringValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest returns an error that will respond with HTTP 400 Bad Request.
func ExtractFromFile ¶
func Forbidden ¶
Forbidden returns an error that will respond with HTTP 403 Forbidden.
func NotFound ¶
func NotFound() error
NotFound returns an error that will respond with HTTP 404 Not Found.
func RespondError ¶
func RespondError(err error, w http.ResponseWriter, r *http.Request)
RespondError writes an error response to the client. If the error is an HttpError, it uses the specified status code and message. Otherwise, it logs the error and returns a generic 500 Internal Server Error with a unique ID.
Types ¶
type BytesValue ¶
type BytesValue struct {
// contains filtered or unexported fields
}
func Bytes ¶
func Bytes(b []byte) BytesValue
func (BytesValue) ServeHTTP ¶
func (b BytesValue) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HttpError ¶
HttpError represents an HTTP error with a status code and message.
type JSONValue ¶
type JSONValue struct {
// contains filtered or unexported fields
}
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
func String ¶
func String(s string) StringValue
func (StringValue) ServeHTTP ¶
func (s StringValue) ServeHTTP(w http.ResponseWriter, r *http.Request)
Source Files
¶
- converters.go
- errors.go
- extractors.go
- response.go
Click to show internal directories.
Click to hide internal directories.