Documentation ¶
Index ¶
- func Adapt(h http.Handler, adapters ...Adapter) http.Handler
- func BindJSON(w http.ResponseWriter, r *http.Request, dest interface{}) error
- func DeleteCookie(writer http.ResponseWriter, request *http.Request, name string) (string, error)
- func GetCookie(writer http.ResponseWriter, request *http.Request, name string) (string, error)
- func GetImage(w http.ResponseWriter, r *http.Request, i *Imager)
- func ReadFile(fileHeader *multipart.FileHeader, ir MultipartReader, MaxSize int64, ...) error
- func RedirectJSONResponse(writer http.ResponseWriter, request *http.Request, url string, v any)
- func RequestLogger(next http.Handler) http.Handler
- func SetRecaptchaKey(key string)
- func WriteBytesResponse(w http.ResponseWriter, v []byte)
- func WriteJSONError(writer http.ResponseWriter, text string, code int)
- func WriteJSONResponse(w http.ResponseWriter, v any)
- func WriteMultipartResponse(w http.ResponseWriter, v map[string][]byte)
- type Adapter
- type Endpoint
- type Imager
- type MultipartReader
- type PathHandler
- type ReCaptcher
- type RecaptchaResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindJSON ¶ added in v0.0.5
func BindJSON(w http.ResponseWriter, r *http.Request, dest interface{}) error
func DeleteCookie ¶ added in v0.0.5
DeleteCookie receives cookie from gin.Context, deletes this cookie from gin.Context and returns its value or error.
func GetCookie ¶ added in v0.0.5
GetCookie receives cookie from gin.Context or raise http.StatusForbidden error, returns cookie or error
func ReadFile ¶ added in v0.0.5
func ReadFile(fileHeader *multipart.FileHeader, ir MultipartReader, MaxSize int64, allowedFileTypes []string) error
func RedirectJSONResponse ¶ added in v0.0.5
func SetRecaptchaKey ¶
func SetRecaptchaKey(key string)
SetRecaptchaKey is function that set recaptcha secret key
func WriteBytesResponse ¶ added in v0.0.5
func WriteBytesResponse(w http.ResponseWriter, v []byte)
func WriteJSONError ¶ added in v0.0.5
func WriteJSONError(writer http.ResponseWriter, text string, code int)
func WriteJSONResponse ¶ added in v0.0.5
func WriteJSONResponse(w http.ResponseWriter, v any)
func WriteMultipartResponse ¶ added in v0.0.5
func WriteMultipartResponse(w http.ResponseWriter, v map[string][]byte)
Types ¶
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
func (*Endpoint) Handle ¶ added in v0.0.4
func (e *Endpoint) Handle(h ...PathHandler)
type MultipartReader ¶ added in v0.0.5
type MultipartReader interface {
ReadFromMultipart(fileHeader *multipart.FileHeader, allowedFileTypes []string) error
}
type PathHandler ¶
type PathHandler struct { Path string GET, POST, PUT, PATCH, DELETE http.HandlerFunc }
func (PathHandler) ServeHTTP ¶
func (ph PathHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ReCaptcher ¶
type ReCaptcher interface {
GetReCaptcha() string
}
type RecaptchaResponse ¶
type RecaptchaResponse struct { Success bool `json:"success"` Score float64 `json:"score"` Action string `json:"action"` ChallengeTS time.Time `json:"challenge_ts"` Hostname string `json:"hostname"` ErrorCodes []string `json:"error-codes"` }
RecaptchaResponse is struct that contains recaptcha validating response fields
func VerifyReCaptcha ¶
func VerifyReCaptcha(recaptcha string) (RecaptchaResponse, error)
VerifyReCaptcha is ...
Click to show internal directories.
Click to hide internal directories.