request

package
v0.2.25 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrangeInput

type OrangeInput struct {
	FormBody []byte
	// contains filtered or unexported fields
}

func NewInput

func NewInput(request *http.Request, maxMemory int64) *OrangeInput

NewInput return OrangeInput.

func (*OrangeInput) AcceptsHTML

func (input *OrangeInput) AcceptsHTML() bool

AcceptsHTML Checks if request accepts html response

func (*OrangeInput) AcceptsJSON

func (input *OrangeInput) AcceptsJSON() bool

AcceptsJSON Checks if request accepts json response

func (*OrangeInput) AcceptsXML

func (input *OrangeInput) AcceptsXML() bool

AcceptsXML Checks if request accepts xml response

func (*OrangeInput) Bind

func (input *OrangeInput) Bind(dest interface{}, key string) error

Bind data from request.Form[key] to dest like /?id=123&isok=true&ft=1.2&ol[0]=1&ol[1]=2&ul[]=str&ul[]=array&user.Name=orange var id int orangeInput.Bind(&id, "id") id ==123 var isok bool orangeInput.Bind(&isok, "isok") isok ==true var ft float64 orangeInput.Bind(&ft, "ft") ft ==1.2 ol := make([]int, 0, 2) orangeInput.Bind(&ol, "ol") ol ==[1 2] ul := make([]string, 0, 2) orangeInput.Bind(&ul, "ul") ul ==[str array] user struct{Name} orangeInput.Bind(&user, "user") user == {Name:"orange"}

func (*OrangeInput) Data

func (input *OrangeInput) Data() map[interface{}]interface{}

Data return the implicit data in the input

func (*OrangeInput) Domain

func (input *OrangeInput) Domain() string

Domain returns host name. Alias of Host method.

func (*OrangeInput) GetData

func (input *OrangeInput) GetData(key interface{}) interface{}

GetData returns the stored data in this context.

func (*OrangeInput) Header

func (input *OrangeInput) Header(key string) string

Header returns request header item string by a given string. if non-existed, return empty string.

func (*OrangeInput) Host

func (input *OrangeInput) Host() string

Host returns host name. if no host info in request, return localhost.

func (*OrangeInput) IP

func (input *OrangeInput) IP() string

IP returns request client ip. if in proxy, return first proxy id. if error, return RemoteAddr.

func (*OrangeInput) Is

func (input *OrangeInput) Is(method string) bool

Is returns boolean of this request is on given method, such as Is("POST").

func (*OrangeInput) IsAjax

func (input *OrangeInput) IsAjax() bool

IsAjax returns boolean of this request is generated by ajax.

func (*OrangeInput) IsDelete

func (input *OrangeInput) IsDelete() bool

IsDelete Is this a DELETE method request?

func (*OrangeInput) IsGet

func (input *OrangeInput) IsGet() bool

IsGet Is this a GET method request?

func (*OrangeInput) IsHead

func (input *OrangeInput) IsHead() bool

IsHead Is this a Head method request?

func (*OrangeInput) IsOptions

func (input *OrangeInput) IsOptions() bool

IsOptions Is this a OPTIONS method request?

func (*OrangeInput) IsPatch

func (input *OrangeInput) IsPatch() bool

IsPatch Is this a PATCH method request?

func (*OrangeInput) IsPost

func (input *OrangeInput) IsPost() bool

IsPost Is this a POST method request?

func (*OrangeInput) IsPut

func (input *OrangeInput) IsPut() bool

IsPut Is this a PUT method request?

func (*OrangeInput) IsSecure

func (input *OrangeInput) IsSecure() bool

IsSecure returns boolean of this request is in https.

func (*OrangeInput) IsUpload

func (input *OrangeInput) IsUpload() bool

IsUpload returns boolean of whether file uploads in this request or not..

func (*OrangeInput) IsWebsocket

func (input *OrangeInput) IsWebsocket() bool

IsWebsocket returns boolean of this request is in webSocket.

func (*OrangeInput) Method

func (input *OrangeInput) Method() string

Method returns http request method.

func (*OrangeInput) Param

func (input *OrangeInput) Param(key string) string

Param returns router param by a given key.

func (*OrangeInput) Params

func (input *OrangeInput) Params() map[string]string

Params returns the map[key]value.

func (*OrangeInput) ParamsLen

func (input *OrangeInput) ParamsLen() int

ParamsLen return the length of the params

func (*OrangeInput) ParseFormOrMulitForm

func (input *OrangeInput) ParseFormOrMulitForm(maxMemory int64) error

ParseFormOrMulitForm parseForm or parseMultiForm based on Content-type

func (*OrangeInput) Protocol

func (input *OrangeInput) Protocol() string

Protocol returns request protocol name, such as HTTP/1.1 .

func (*OrangeInput) Proxy

func (input *OrangeInput) Proxy() []string

Proxy returns proxy client ips slice.

func (*OrangeInput) Query

func (input *OrangeInput) Query(key string) string

Query returns input data item string by a given string.

func (*OrangeInput) Referer

func (input *OrangeInput) Referer() string

Referer returns http referer header.

func (*OrangeInput) Reset

func (input *OrangeInput) Reset(request *http.Request)

Reset init the

func (*OrangeInput) ResetParams

func (input *OrangeInput) ResetParams()

ResetParams clears any of the input's Params This function is used to clear parameters so they may be reset between filter passes.

func (*OrangeInput) Scheme

func (input *OrangeInput) Scheme() string

Scheme returns request scheme as "http" or "https".

func (*OrangeInput) SetData

func (input *OrangeInput) SetData(key, val interface{})

SetData stores data with given key in this context. This data are only available in this context.

func (*OrangeInput) SetParam

func (input *OrangeInput) SetParam(key, val string)

SetParam will set the param with key and value

func (*OrangeInput) Site

func (input *OrangeInput) Site() string

Site returns base site url as scheme://domain type.

func (*OrangeInput) URI

func (input *OrangeInput) URI() string

URI returns full request url with query string, fragment.

func (*OrangeInput) URL

func (input *OrangeInput) URL() string

URL returns request url path (without query string, fragment).

Jump to

Keyboard shortcuts

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