handler

package
v0.13.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeValidationFailed string
)

Functions

This section is empty.

Types

type DefaultRequestsHandler

type DefaultRequestsHandler struct {
	gonethttprequest.Decoder
	// contains filtered or unexported fields
}

DefaultRequestsHandler struct

func NewDefaultRequestsHandler

func NewDefaultRequestsHandler(
	mode *goflagsmode.Flag,
	decoder gonethttprequest.Decoder,
	responsesHandler gonethttphandler.ResponsesHandler,
) (*DefaultRequestsHandler, error)

NewDefaultRequestsHandler creates a new default request handler

Parameters:

  • mode: The flag mode
  • decoder: The HTTP request decoder
  • responsesHandler: The HTTP response handler

Returns:

  • *DefaultRequestsHandler: The default handler
  • error: The error if any

func (DefaultRequestsHandler) DecodeAndValidate

func (d DefaultRequestsHandler) DecodeAndValidate(
	w http.ResponseWriter,
	r *http.Request,
	dest any,
	validatorFn govalidatormappervalidator.ValidateFn,
) bool

DecodeAndValidate decodes and validates the request body

Parameters:

  • w: The HTTP response writer
  • r: The HTTP request
  • dest: The destination to decode the request body into
  • validatorFn: The validator function

Returns:

  • bool: True if the request body is valid, false otherwise

func (DefaultRequestsHandler) Validate

Validate validates the request body

Parameters:

  • w: The HTTP response writer
  • r: The HTTP request
  • body: The request body to validate
  • validatorFn: The validator function

Returns:

  • bool: True if the request body is valid, false otherwise

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL