request

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFailedToBindJSON = errors.New("failed to parse json body")
)

Functions

func BindJSON

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

BindJSON decodes the body of a http request to the provided struct.

func BindQuery

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

BindQuery decodes the url query of a http request to the provided struct.

func GetAuthContext

func GetAuthContext(ctx context.Context) (*core.AuthContext, bool)

SessionFrom returns the auth context for the given context.

func NumericURLParam

func NumericURLParam(r *http.Request, name string) (int64, error)

NumericURLParam returns a url parameter as int64.

func RemoteAddr

func RemoteAddr(r *http.Request) string

RemoteAddr returns the "real" IP address.

func WithAuthContext

func WithAuthContext(parent context.Context, auth *core.AuthContext) context.Context

WithAuthContext returns a copy of parent ctx which includes the auth context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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