Documentation ¶
Overview ¶
Package http provides a set of utilities for handling HTTP requests and responses within the GoFr framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorEntityAlreadyExist ¶
type ErrorEntityAlreadyExist struct { }
ErrorEntityAlreadyExist represents an error for when entity is already present in the storage and we are trying to make duplicate entry.
func (ErrorEntityAlreadyExist) Error ¶
func (ErrorEntityAlreadyExist) Error() string
func (ErrorEntityAlreadyExist) StatusCode ¶
func (ErrorEntityAlreadyExist) StatusCode() int
type ErrorEntityNotFound ¶
ErrorEntityNotFound represents an error for when an entity is not found in the system.
func (ErrorEntityNotFound) Error ¶
func (e ErrorEntityNotFound) Error() string
func (ErrorEntityNotFound) StatusCode ¶
func (ErrorEntityNotFound) StatusCode() int
type ErrorInvalidParam ¶
type ErrorInvalidParam struct {
Params []string `json:"param,omitempty"` // Params contains the list of invalid parameter names.
}
ErrorInvalidParam represents an error for invalid parameter values.
func (ErrorInvalidParam) Error ¶
func (e ErrorInvalidParam) Error() string
func (ErrorInvalidParam) StatusCode ¶
func (ErrorInvalidParam) StatusCode() int
type ErrorInvalidRoute ¶
type ErrorInvalidRoute struct{}
ErrorInvalidRoute represents an error for invalid route in a request.
func (ErrorInvalidRoute) Error ¶
func (ErrorInvalidRoute) Error() string
func (ErrorInvalidRoute) StatusCode ¶
func (ErrorInvalidRoute) StatusCode() int
type ErrorMissingParam ¶
type ErrorMissingParam struct {
Params []string `json:"param,omitempty"`
}
ErrorMissingParam represents an error for missing parameters in a request.
func (ErrorMissingParam) Error ¶
func (e ErrorMissingParam) Error() string
func (ErrorMissingParam) StatusCode ¶
func (ErrorMissingParam) StatusCode() int
type ErrorPanicRecovery ¶
type ErrorPanicRecovery struct{}
ErrorPanicRecovery represents an error for request which panicked.
func (ErrorPanicRecovery) Error ¶
func (ErrorPanicRecovery) Error() string
func (ErrorPanicRecovery) StatusCode ¶
func (ErrorPanicRecovery) StatusCode() int
type ErrorRequestTimeout ¶
type ErrorRequestTimeout struct{}
ErrorRequestTimeout represents an error for request which timed out.
func (ErrorRequestTimeout) Error ¶
func (ErrorRequestTimeout) Error() string
func (ErrorRequestTimeout) StatusCode ¶
func (ErrorRequestTimeout) StatusCode() int
type Metrics ¶
Metrics represents an interface for registering the default metrics in GoFr framework.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is an abstraction over the underlying http.Request. This abstraction is useful because it allows us to create applications without being aware of the transport. cmd.Request is another such abstraction.
func NewRequest ¶
NewRequest creates a new GoFr Request instance from the given http.Request.
type Responder ¶
type Responder struct {
// contains filtered or unexported fields
}
Responder encapsulates an http.ResponseWriter and is responsible for crafting structured responses.
func NewResponder ¶
func NewResponder(w http.ResponseWriter, method string) *Responder
NewResponder creates a new Responder instance from the given http.ResponseWriter..
type Router ¶
Router is responsible for routing HTTP request.
func (*Router) Add ¶
Add adds a new route with the given HTTP method, pattern, and handler, wrapping the handler with OpenTelemetry instrumentation.
func (*Router) AddStaticFiles ¶
func (*Router) UseMiddleware ¶
func (rou *Router) UseMiddleware(mws ...Middleware)
UseMiddleware registers middlewares to the router.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package middleware provides a collection of middleware functions that handles various aspects of request handling, such as authentication, logging, tracing, and metrics collection.
|
Package middleware provides a collection of middleware functions that handles various aspects of request handling, such as authentication, logging, tracing, and metrics collection. |