reqdata

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ErrInvalidJSON = cerr("invalid json")

ErrInvalidJSON is returned when json parse failed

View Source
const ErrInvalidMultipart = cerr("invalid multipart")

ErrInvalidMultipart is returned when multipart parse failed

View Source
const ErrInvalidType = cerr("invalid type")

ErrInvalidType - parameter value does not satisfy its type

View Source
const ErrMissingRequiredParam = cerr("missing required param")

ErrMissingRequiredParam - required param is missing

View Source
const ErrMissingURIParameter = cerr("missing URI parameter")

ErrMissingURIParameter - missing an URI parameter

View Source
const ErrParseParameter = cerr("cannot parse parameter")

ErrParseParameter is returned when a parameter fails when parsing

View Source
const ErrUnknownType = cerr("unknown type")

ErrUnknownType is returned when encountering an unknown type

Variables

This section is empty.

Functions

This section is empty.

Types

type T added in v0.3.1

type T struct {
	Data map[string]interface{}
	// contains filtered or unexported fields
}

T represents all data that can be caught from an http request for a specific configuration Service; it features: - URI (from the URI) - GET (standard url data) - POST (from json, form-data, url-encoded)

  • 'application/json' => key-value pair is parsed as json into the map
  • 'application/x-www-form-urlencoded' => standard parameters as QUERY parameters
  • 'multipart/form-data' => parse form-data format

func New

func New(service *config.Service) *T

New creates a new empty store.

func (*T) GetForm added in v0.3.1

func (i *T) GetForm(req http.Request) error

GetForm parameters the from request - parse 'form-data' if not supported for non-POST requests - parse 'x-www-form-urlencoded' - parse 'application/json'

func (*T) GetQuery added in v0.3.1

func (i *T) GetQuery(req http.Request) error

GetQuery data from the url query parameters

func (*T) GetURI added in v0.3.1

func (i *T) GetURI(req http.Request) error

GetURI parameters

Jump to

Keyboard shortcuts

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