decode

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package decode contains decoders for various HTTP artefacts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(dst interface{}, r *http.Request) error

All populates the struct pointed to by dst with query params, req body params and request path variables, respectively, with path variables taking precedence over body params, and body params over query params.

func Form

func Form(dst interface{}, r *http.Request) error

Form decodes an HTTP request's POST form contents into dst.

func Param

func Param(name string, r *http.Request) (string, error)

Param retrieves a single parameter by name from the request, first checking the body (if POST/PUT/PATCH) and the query, falling back to looking for a path variable.

func Query

func Query(dst interface{}, query url.Values) error

Query unmarshals a query string (k1=v1&k2=v2...) into dst.

func RegisterConverter

func RegisterConverter(v any, fn schema.Converter)

func Route

func Route(dst interface{}, r *http.Request) error

Route decodes a mux route parameters (e.g. /foo/{bar}) into dst.

Types

This section is empty.

Jump to

Keyboard shortcuts

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