request

package
v1.0.46 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRF

func CSRF(r *http.Request) string

CSRF returns the current CSRF token.

func ClientIP

func ClientIP(r *http.Request) string

ClientIP returns the client IP address stored in the context.

func CookieValue

func CookieValue(r *http.Request, name string) string

CookieValue returns the cookie value.

func FindClientIP

func FindClientIP(r *http.Request) string

FindClientIP returns the client real IP address based on trusted Reverse-Proxy HTTP headers.

func FindRemoteIP

func FindRemoteIP(r *http.Request) string

FindRemoteIP returns remote client IP address.

func FlashErrorMessage

func FlashErrorMessage(r *http.Request) string

FlashErrorMessage returns the message error message if any.

func FlashMessage

func FlashMessage(r *http.Request) string

FlashMessage returns the message message if any.

func FormInt64Value

func FormInt64Value(r *http.Request, param string) int64

FormInt64Value returns a form value as integer.

func GoolgeReaderToken

func GoolgeReaderToken(r *http.Request) string

GoolgeReaderToken returns the google reader token if it exists.

func HasQueryParam

func HasQueryParam(r *http.Request, param string) bool

HasQueryParam checks if the query string contains the given parameter.

func IsAdminUser

func IsAdminUser(r *http.Request) bool

IsAdminUser checks if the logged user is administrator.

func IsAuthenticated

func IsAuthenticated(r *http.Request) bool

IsAuthenticated returns a boolean if the user is authenticated.

func OAuth2State

func OAuth2State(r *http.Request) string

OAuth2State returns the current OAuth2 state.

func PocketRequestToken

func PocketRequestToken(r *http.Request) string

PocketRequestToken returns the Pocket Request Token if any.

func QueryInt64Param

func QueryInt64Param(r *http.Request, param string, defaultValue int64) int64

QueryInt64Param returns a query string parameter as int64.

func QueryIntParam

func QueryIntParam(r *http.Request, param string, defaultValue int) int

QueryIntParam returns a query string parameter as integer.

func QueryStringParam

func QueryStringParam(r *http.Request, param, defaultValue string) string

QueryStringParam returns a query string parameter as string.

func QueryStringParamList

func QueryStringParamList(r *http.Request, param string) []string

QueryStringParamList returns all values associated to the parameter.

func RouteInt64Param

func RouteInt64Param(r *http.Request, param string) int64

RouteInt64Param returns an URL route parameter as int64.

func RouteStringParam

func RouteStringParam(r *http.Request, param string) string

RouteStringParam returns a URL route parameter as string.

func SessionID

func SessionID(r *http.Request) string

SessionID returns the current session ID.

func UserID

func UserID(r *http.Request) int64

UserID returns the UserID of the logged user.

func UserLanguage

func UserLanguage(r *http.Request) string

UserLanguage get the locale used by the current logged user.

func UserSessionToken

func UserSessionToken(r *http.Request) string

UserSessionToken returns the current user session token.

func UserTheme

func UserTheme(r *http.Request) string

UserTheme get the theme used by the current logged user.

func UserTimezone

func UserTimezone(r *http.Request) string

UserTimezone returns the timezone used by the logged user.

Types

type ContextKey

type ContextKey int

ContextKey represents a context key.

const (
	UserIDContextKey ContextKey = iota
	UserTimezoneContextKey
	IsAdminUserContextKey
	IsAuthenticatedContextKey
	UserSessionTokenContextKey
	UserLanguageContextKey
	UserThemeContextKey
	SessionIDContextKey
	CSRFContextKey
	OAuth2StateContextKey
	FlashMessageContextKey
	FlashErrorMessageContextKey
	PocketRequestTokenContextKey
	ClientIPContextKey
	GoogleReaderToken
)

List of context keys.

Jump to

Keyboard shortcuts

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