request

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind added in v1.7.2

func Bind(r *http.Request, obj interface{}) error

func BindJSON added in v1.7.2

func BindJSON(r *http.Request, obj interface{}) error

BindJSON is a shortcut for c.MustBindWith(obj, binding.JSON).

func BindQuery added in v1.7.2

func BindQuery(r *http.Request, obj interface{}) error

BindQuery is a shortcut for c.MustBindWith(obj, binding.Query).

func BindUri added in v1.7.2

func BindUri(r *http.Request, obj interface{}) error

MustBindWith binds the passed struct pointer using the specified binding engine. BindUri binds the passed struct pointer using binding.Uri. It will abort the request with HTTP 400 if any error occurs.

func BindXML added in v1.7.2

func BindXML(r *http.Request, obj interface{}) error

BindXML is a shortcut for c.MustBindWith(obj, binding.BindXML).

func BindYAML added in v1.7.2

func BindYAML(r *http.Request, obj interface{}) error

BindYAML is a shortcut for c.MustBindWith(obj, binding.YAML).

func Error

func Error(err error) string

func GetToken added in v1.7.7

func GetToken(r *http.Request) string

func MustBindWith added in v1.7.2

func MustBindWith(r *http.Request, obj interface{}, b binding.Binding) error

MustBindWith binds the passed struct pointer using the specified binding engine. It will abort the request with HTTP 400 if any error occurs. See the binding package.

func ShouldBind added in v1.7.2

func ShouldBind(r *http.Request, obj interface{}) error

ShouldBind checks the Content-Type to select a binding engine automatically, Depending the "Content-Type" header different bindings are used:

"application/json" --> JSON binding
"application/xml"  --> XML binding

otherwise --> returns an error It parses the request's body as JSON if Content-Type == "application/json" using JSON or XML as a JSON input. It decodes the json payload into the struct specified as a pointer. Like c.GinBind() but this method does not set the response status code to 400 and abort if the json is not valid.

func ShouldBindJSON added in v1.7.2

func ShouldBindJSON(r *http.Request, obj interface{}) error

ShouldBindJSON is a shortcut for c.ShouldBindWith(obj, binding.JSON).

func ShouldBindQuery added in v1.7.2

func ShouldBindQuery(r *http.Request, obj interface{}) error

ShouldBindQuery is a shortcut for c.ShouldBindWith(obj, binding.Query).

func ShouldBindUri added in v1.7.2

func ShouldBindUri(r *http.Request, obj interface{}) error

ShouldBindUri binds the passed struct pointer using the specified binding engine.

func ShouldBindWith added in v1.7.2

func ShouldBindWith(r *http.Request, obj interface{}, b binding.Binding) error

ShouldBindWith binds the passed struct pointer using the specified binding engine. See the binding package.

func ShouldBindXML added in v1.7.2

func ShouldBindXML(r *http.Request, obj interface{}) error

ShouldBindXML is a shortcut for c.ShouldBindWith(obj, binding.XML).

func ShouldBindYAML added in v1.7.2

func ShouldBindYAML(r *http.Request, obj interface{}) error

ShouldBindYAML is a shortcut for c.ShouldBindWith(obj, binding.YAML).

Types

type RequestAt

type RequestAt struct {
	Time       time.Time
	TimeStamp  int64
	TimeString string
}

func NewRequestAt

func NewRequestAt() *RequestAt

func NewRequestAtByTime

func NewRequestAtByTime(t time.Time) *RequestAt

func (*RequestAt) String

func (r *RequestAt) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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