Documentation
¶
Index ¶
- Constants
- Variables
- func LimitBody(w http.ResponseWriter, r *http.Request, maxSize int64)
- func ParseBool(str string) (bool, error)
- type Configuration
- func (conf *Configuration) Clone() *Configuration
- func (conf *Configuration) Decode(r *http.Request, pathParams any, dest any) error
- func (conf *Configuration) DecodeVal(r *http.Request, pathParams any, destValPtr reflect.Value) error
- func (conf *Configuration) EncodeToPath(source any, path string) string
- func (conf *Configuration) EncodeToValues(source any, values url.Values)
- func (conf *Configuration) Strict() *Configuration
- type Error
- type ParserFunc
- type StringerFunc
Constants ¶
View Source
const MB = 1 << 20
MB is 1 megabyte in bytes, i.e. 1024 * 1024
Variables ¶
View Source
var Default = &Configuration{ AllowJSON: true, AllowForm: true, AllowMultipart: true, JSONBodyFallbackParam: "_body", MaxMultipartMemory: 32 * MB, DisallowUnknownFields: false, }
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct { AllowJSON bool AllowForm bool AllowMultipart bool JSONBodyFallbackParam string MaxMultipartMemory int64 DisallowUnknownFields bool AllowUnknownFieldsHeader string // contains filtered or unexported fields }
func (*Configuration) Clone ¶
func (conf *Configuration) Clone() *Configuration
func (*Configuration) Decode ¶
Decode ...
Warning: use LimitBody on request before calling Decode to avoid out-of-memory DoS attacks.
func (*Configuration) DecodeVal ¶
func (conf *Configuration) DecodeVal(r *http.Request, pathParams any, destValPtr reflect.Value) error
DecodeVal ...
Warning: use LimitBody on request before calling DecodeVal to avoid out-of-memory DoS attacks.
func (*Configuration) EncodeToPath ¶
func (conf *Configuration) EncodeToPath(source any, path string) string
func (*Configuration) EncodeToValues ¶
func (conf *Configuration) EncodeToValues(source any, values url.Values)
EncodeToValues is a counterpart to Decode.
func (*Configuration) Strict ¶
func (conf *Configuration) Strict() *Configuration
Click to show internal directories.
Click to hide internal directories.