Documentation ¶
Index ¶
- Variables
- func CleanUpTmpDir(tmpDir string)
- func DecodeForm(r *http.Request, ps httprouter.Params, args interface{}) error
- func DecodeJSON(r *http.Request, args interface{}) error
- func LoadSession(r *http.Request, key string, session interface{}) error
- func Redirect(w http.ResponseWriter, r *http.Request, URL string, args ...interface{})
- func RespondJSON(w http.ResponseWriter, obj interface{})
- func SaveFormFileToTmp(r *http.Request, key string) (string, string, error)
- func SaveFormFilesToTmp(r *http.Request) (string, []string, error)
- func SetSchemaDecoder(decoder *schema.Decoder)
- func SetSessionKeys(signingKey, cryptKey []byte)
- func StoreSession(w http.ResponseWriter, key string, maxAge int, session interface{}) error
- type TokenHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrShortKey = errors.New("Signing/encryption keys must be 32 characters") ErrGenIV = errors.New("Failed to generate initialization vector") ErrBadSig = errors.New("Invalid signature") ErrBadData = errors.New("Invalid input data") )
View Source
var MaxMemory int64 = 4194304
Functions ¶
func CleanUpTmpDir ¶
func CleanUpTmpDir(tmpDir string)
Delete the temporary directory created by the `SaveFormFilesToTmp` function.
func DecodeForm ¶
func DecodeForm( r *http.Request, ps httprouter.Params, args interface{}, ) error
Decode form arguments. Arguments are first pulled from the URL (httprouter), then from the form.
func DecodeJSON ¶
func Redirect ¶
func Redirect( w http.ResponseWriter, r *http.Request, URL string, args ...interface{}, )
Redirect with 302 status. This isn't the most modern way to do this, but it seems to be more robust in older browsers.
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, obj interface{})
func SaveFormFileToTmp ¶
func SaveFormFilesToTmp ¶
Save posted file to a temporary directory and file, returning the directory, to full path to each file, and an error.
Use CleanUpTmpDir to delete the temporary directory created.
func SetSchemaDecoder ¶
Override the default schema decoder.
func SetSessionKeys ¶
func SetSessionKeys(signingKey, cryptKey []byte)
Both keys should be 32 bytes.
func StoreSession ¶
func StoreSession( w http.ResponseWriter, key string, maxAge int, session interface{}, ) error
Types ¶
type TokenHandler ¶
type TokenHandler struct {
// contains filtered or unexported fields
}
func NewTokenHandler ¶
func NewTokenHandler(signingKey, cryptKey []byte) (TokenHandler, error)
func (TokenHandler) Decode ¶
func (h TokenHandler) Decode(encoded64 []byte, value interface{}) error
func (TokenHandler) Encode ¶
func (h TokenHandler) Encode(value interface{}) ([]byte, error)
Click to show internal directories.
Click to hide internal directories.