x

package
v0.0.1-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyUUID db.UUID

Functions

func AssertEqualTime

func AssertEqualTime(t *testing.T, expected, actual time.Time)

func DetermineReturnToURL

func DetermineReturnToURL(request *url.URL, defaultReturnTo *url.URL, whitelistedDomains []url.URL) (string, error)

func IsJSONRequest

func IsJSONRequest(r *http.Request) bool

func IsValidNumber

func IsValidNumber(s string) bool

IsValidNumber reports whether s is a valid JSON number literal.

Taken from encoding/json

func IsZeroUUID

func IsZeroUUID(id db.UUID) bool

func MustEncodeJSON

func MustEncodeJSON(t *testing.T, in interface{}) string

func MustReadAll

func MustReadAll(r io.Reader) []byte

func NewCSRFHandler

func NewCSRFHandler(
	router http.Handler,
	writer herodot.Writer,
	logger logrus.FieldLogger,
	path string,
	domain string,
	secure bool,
) *nosurf.CSRFHandler

func NewTestHTTPRequest

func NewTestHTTPRequest(t *testing.T, method, url string, body io.Reader) *http.Request

func NewUUID

func NewUUID() db.UUID

func ParseUUID

func ParseUUID(in string) db.UUID

func RequireEqualTime

func RequireEqualTime(t *testing.T, expected, actual time.Time)

func SessionGetString

func SessionGetString(r *http.Request, s sessions.Store, id string, key interface{}) (string, error)

SessionGetString returns a string for the given id and key or an error if the session is invalid, the key does not exist, or the key value is not a string.

func SessionGetStringOr

func SessionGetStringOr(r *http.Request, s sessions.Store, id, key, fallback string) string

SessionGetStringOr returns a string for the given id and key or the fallback value if the session is invalid, the key does not exist, or the key value is not a string.

func SessionPersistValues

func SessionPersistValues(w http.ResponseWriter, r *http.Request, s sessions.Store, id string, values map[string]interface{}) error

SessionPersistValues adds values to the session store and persists the changes.

func TypeMap

func TypeMap(m map[string]string) (map[string]interface{}, error)

func UntypedMapToJSON

func UntypedMapToJSON(m map[string]string) (json.RawMessage, error)

Types

type CSRFProvider

type CSRFProvider interface {
	CSRFHandler() *nosurf.CSRFHandler
}

type CookieProvider

type CookieProvider interface {
	CookieManager() sessions.Store
}

type Ider

type Ider interface {
	RequestID() string
}

type LoggingProvider

type LoggingProvider interface {
	Logger() logrus.FieldLogger
}

type RouterAdmin

type RouterAdmin struct {
	*httprouter.Router
}

func NewRouterAdmin

func NewRouterAdmin() *RouterAdmin

type RouterPublic

type RouterPublic struct {
	*httprouter.Router
}

func NewRouterPublic

func NewRouterPublic() *RouterPublic

type WriterProvider

type WriterProvider interface {
	Writer() herodot.Writer
}

Jump to

Keyboard shortcuts

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