Documentation ¶
Index ¶
- Variables
- func Adapt(h http.Handler, adapters ...Adapter) http.Handler
- func GetCookie(r *http.Request, name string) (*sessions.Session, error)
- func GetCookieKeyPairs() (keyPairs string)
- func GetCookieStore() *sessions.CookieStore
- func GetUserIp(r *http.Request) string
- func Log(v ...interface{})
- func Logf(f string, v ...interface{})
- func NewCookie(r *http.Request, name string) (*sessions.Session, error)
- func ReplyJson(w http.ResponseWriter, ret interface{}) (int, error)
- func ReplyJsonWithCode(w http.ResponseWriter, ret interface{}, code int) (int, error)
- func SaveCookie(r *http.Request, w http.ResponseWriter, s *sessions.Session) error
- func SetCookieKeyPairs(keyPairs string)
- func WebLog(r *http.Request, v ...interface{})
- func WebLogf(r *http.Request, f string, v ...interface{})
- type Adapter
- type FileInfo
- type MultipartFormReader
- type MultipartFormReaderOption
- type Once
Constants ¶
This section is empty.
Variables ¶
View Source
var AccessControlAllowCredentials = true
View Source
var AccessControlAllowHeaders = []string{
"Content-Type",
"Content-Length",
"Accept-Encoding",
"Content-Range",
"Content-Disposition",
"Authorization",
"X-Requested-With",
}
View Source
var AccessControlAllowMethods = []string{
"POST",
"GET",
"OPTIONS",
"PUT",
"PATCH",
"DELETE",
}
Functions ¶
func GetCookie ¶
Get returns a session for the given name after adding it to the registry.
It returns a new session if the sessions doesn't exist. Access IsNew on the session to check if it is an existing session or a new one.
It returns a new session and an error if the session exists but could not be decoded.
func GetCookieKeyPairs ¶
func GetCookieKeyPairs() (keyPairs string)
func GetCookieStore ¶
func GetCookieStore() *sessions.CookieStore
func NewCookie ¶
New returns a session for the given name without adding it to the registry.
The difference between New() and Get() is that calling New() twice will decode the session data twice, while Get() registers and reuses the same decoded session after the first call.
func ReplyJsonWithCode ¶
func ReplyJsonWithCode(w http.ResponseWriter, ret interface{}, code int) (int, error)
func SaveCookie ¶
Save adds a single session to the response.
func SetCookieKeyPairs ¶
func SetCookieKeyPairs(keyPairs string)
Types ¶
type Adapter ¶
func CORSMiddleware ¶
func CORSMiddleware() Adapter
type MultipartFormReader ¶
func NewMultipartFormReader ¶
func NewMultipartFormReader(r *http.Request, options ...MultipartFormReaderOption) (mr *MultipartFormReader)
func (*MultipartFormReader) GetString ¶
func (mr *MultipartFormReader) GetString(field string) string
func (*MultipartFormReader) HandleFile ¶
func (mr *MultipartFormReader) HandleFile(field string, f func(multipart.File, *multipart.FileHeader) error) (err error)
type MultipartFormReaderOption ¶
type MultipartFormReaderOption struct {
MaxMemoryMB int64
}
func NewDefaultMultipartFormReaderOption ¶
func NewDefaultMultipartFormReaderOption() MultipartFormReaderOption
Source Files ¶
Click to show internal directories.
Click to hide internal directories.