httputil

package
v0.0.0-...-b4bca67 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TurnstileVerifyTimeout = 5 * time.Second

Variables

View Source
var (
	ErrAmbiguousValues     = errors.New("differing values found")
	ErrValueUnexpectedType = errors.New("value is an unexpected type")
)

Functions

This section is empty.

Types

type JSONObject

type JSONObject map[string]interface{}

type RequestValues

type RequestValues struct {
	// contains filtered or unexported fields
}

func ParseRequest

func ParseRequest(req *http.Request) *RequestValues

returns a *RequestValues which lazily parses body and url values

func (*RequestValues) Body

func (p *RequestValues) Body() ([]byte, error)

func (*RequestValues) BodyText

func (p *RequestValues) BodyText() (string, error)

func (*RequestValues) ContentType

func (p *RequestValues) ContentType() string

func (*RequestValues) Form

func (p *RequestValues) Form() (url.Values, error)

func (*RequestValues) GetString

func (p *RequestValues) GetString(key string) (string, error)

returns the request value associated with key. if key is not found, returns empty string and nil error. if differing values are found, returns the first value and ErrAmbiguousValues. if an associated value is not a string, returns the first string, if any, and ErrValueUnexpectedType. may also return errors related to parsing the request.

func (*RequestValues) JSONObject

func (p *RequestValues) JSONObject() (JSONObject, error)

func (*RequestValues) Query

func (p *RequestValues) Query() url.Values

func (*RequestValues) Values

func (p *RequestValues) Values(key string) (vals []interface{}, err error)

returns all request values associated with key. parses values from request body and url based on method and content-type.

type TurnstileSite

type TurnstileSite struct {
	Secret string
}

func (*TurnstileSite) Verify

func (ts *TurnstileSite) Verify(token string) (bool, error)

Jump to

Keyboard shortcuts

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