decode

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MPL-2.0 Imports: 7 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, cookie values, and request path variables, with the following precedence: 1. cookies 2. path variables 3. body params 4. query params

func Decode added in v0.3.15

func Decode(dst interface{}, src map[string][]string) error

func Form

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

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

func ID added in v0.3.6

func ID(name string, r *http.Request) (resource.TfeID, error)

ID retrieves a single parameter by name from the request and parses into a resource ID.

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 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