Documentation
¶
Overview ¶
Package request provides utilities for HTTP request parsing and validation middleware.
Index ¶
- type AuthFormData
- type ContentType
- type Utils
- func (ru *Utils) GetContentType(c echo.Context) ContentType
- func (ru *Utils) IsAJAXRequest(c echo.Context) bool
- func (ru *Utils) ParseAuthData(c echo.Context) (*AuthFormData, error)
- func (ru *Utils) ParseRequestData(c echo.Context, target any) error
- func (ru *Utils) SanitizeEmail(input string) string
- func (ru *Utils) SanitizeString(input string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthFormData ¶
type AuthFormData struct {
Email string `json:"email" form:"email"`
Password string `json:"password" form:"password"`
}
AuthFormData represents common form data structure for login/signup
type ContentType ¶
type ContentType string
ContentType represents the type of content in a request
const ( // ContentTypeJSON represents JSON content type ContentTypeJSON ContentType = "application/json" // ContentTypeForm represents form URL-encoded content type ContentTypeForm ContentType = "application/x-www-form-urlencoded" // ContentTypeMultipart represents multipart form data content type ContentTypeMultipart ContentType = "multipart/form-data" )
type Utils ¶
type Utils struct {
Sanitizer sanitization.ServiceInterface
}
Utils provides common request processing utilities
func NewUtils ¶
func NewUtils(sanitizer sanitization.ServiceInterface) *Utils
NewUtils creates a new request utils instance
func (*Utils) GetContentType ¶
func (ru *Utils) GetContentType(c echo.Context) ContentType
GetContentType determines the content type of the request
func (*Utils) IsAJAXRequest ¶
IsAJAXRequest checks if the request is an AJAX request
func (*Utils) ParseAuthData ¶
func (ru *Utils) ParseAuthData(c echo.Context) (*AuthFormData, error)
ParseAuthData parses authentication form data
func (*Utils) ParseRequestData ¶
ParseRequestData parses request data based on content type
func (*Utils) SanitizeEmail ¶
SanitizeEmail sanitizes an email input
func (*Utils) SanitizeString ¶
SanitizeString sanitizes a string input using XSS protection
Click to show internal directories.
Click to hide internal directories.