httpx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(r *http.Request, v any, pattern string) error

Parse parses the request.

func ParseForm

func ParseForm(r *http.Request, v any) error

ParseForm parses the form request.

func ParseHeader

func ParseHeader(headerValue string) map[string]string

ParseHeader parses the request header and returns a map.

func ParseHeaders

func ParseHeaders(r *http.Request, v any) error

ParseHeaders parses the headers request.

func ParseJsonBody

func ParseJsonBody(r *http.Request, v any) error

ParseJsonBody parses the post request which contains json in body.

func ParsePath

func ParsePath(r *http.Request, v any, pattern string) error

ParsePath parses the symbols residing in the URL path.

func SetValidator

func SetValidator(val Validator)

SetValidator sets the validator. The validator is used to validate the request, only called in Parse, not in ParseHeaders, ParseForm, ParseHeader, ParseJsonBody, ParsePath.

func ValidateStruct

func ValidateStruct(v any) error

ValidateStruct validates the struct fields based on the `validate` tag.

Types

type Validator

type Validator interface {
	// Validate validates the request and parsed data.
	Validate(r *http.Request, data any) error
}

Validator defines the interface for validating the request.

Jump to

Keyboard shortcuts

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