MCPcopy Create free account
hub / github.com/kataras/iris / ReadQuery

Method ReadQuery

context/context.go:3127–3142  ·  view source on GitHub ↗

ReadQuery binds URL Query to "ptr". The struct field tag is "url". Example: https://github.com/kataras/iris/blob/main/_examples/request-body/read-query/main.go

(ptr interface{})

Source from the content-addressed store, hash-verified

3125//
3126// Example: https://github.com/kataras/iris/blob/main/_examples/request-body/read-query/main.go
3127func (ctx *Context) ReadQuery(ptr interface{}) error {
3128 values := ctx.getQuery()
3129 if len(values) == 0 {
3130 if ctx.app.ConfigurationReadOnly().GetFireEmptyFormError() {
3131 return ErrEmptyForm
3132 }
3133 return nil
3134 }
3135
3136 err := schema.DecodeQuery(values, ptr)
3137 if err != nil {
3138 return err
3139 }
3140
3141 return ctx.app.Validate(ptr)
3142}
3143
3144// ReadHeaders binds request headers to "ptr". The struct field tag is "header".
3145//

Callers 5

ReadBodyMethod · 0.95
main.goFile · 0.80
mainFunction · 0.80
mainFunction · 0.80
ReadQueryFunction · 0.80

Calls 4

getQueryMethod · 0.95
GetFireEmptyFormErrorMethod · 0.65
ConfigurationReadOnlyMethod · 0.65
ValidateMethod · 0.65

Tested by

no test coverage detected