decoderx

package
v0.0.81 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 13 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct{}

HTTP decodes json and form-data from HTTP Request Bodies.

func NewHTTP

func NewHTTP() *HTTP

NewHTTP creates a new HTTP decoder.

func (*HTTP) Decode

func (t *HTTP) Decode(r *http.Request, destination interface{}, opts ...HTTPDecoderOption) error

Decode takes a HTTP Request Body and decodes it into destination.

type HTTPDecoderOption

type HTTPDecoderOption func(*httpDecoderOptions)

HTTPDecoderOption configures the HTTP decoder.

func HTTPFormDecoder

func HTTPFormDecoder() HTTPDecoderOption

HTTPFormDecoder configures the HTTP decoder to only accept form-data (application/x-www-form-urlencoded, multipart/form-data)

func HTTPJSONDecoder

func HTTPJSONDecoder() HTTPDecoderOption

HTTPJSONDecoder configures the HTTP decoder to only accept form-data (application/json)

func HTTPJSONSchema

func HTTPJSONSchema(jl gojsonschema.JSONLoader) HTTPDecoderOption

HTTPJSONSchema sets a JSON schema to be used for validation and type assertion of incoming requests.

Jump to

Keyboard shortcuts

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