Documentation ¶
Index ¶
Constants ¶
View Source
const ( HeaderAccept = "Accept" HeaderAcceptEncoding = "Accept-Encoding" HeaderAllow = "Allow" HeaderAuthorization = "Authorization" HeaderContentDisposition = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" HeaderCookie = "Cookie" HeaderSetCookie = "Set-Cookie" HeaderIfModifiedSince = "If-Modified-Since" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderUpgrade = "Upgrade" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol" HeaderXForwardedSsl = "X-Forwarded-Ssl" HeaderXUrlScheme = "X-Url-Scheme" HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" HeaderXRealIP = "X-Real-IP" HeaderXRequestID = "X-Request-ID" HeaderXRequestedWith = "X-Requested-With" HeaderServer = "Server" HeaderOrigin = "Origin" HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXXSSProtection = "X-XSS-Protection" HeaderXFrameOptions = "X-Frame-Options" HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderXCSRFToken = "X-CSRF-Token" )
Header types
View Source
const ( MimeApplicationJSON = "application/json; " + CharsetUTF8 MimeApplicationJavaScript = "application/javascript; " + CharsetUTF8 MimeApplicationXML = "application/xml; " + CharsetUTF8 MimeTextXML = "text/xml; " + CharsetUTF8 MimeApplicationForm = "application/x-www-form-urlencoded" MimeApplicationProtobuf = "application/protobuf" MimeApplicationMsgpack = "application/msgpack" MimeTextHTML = "text/html; " + CharsetUTF8 MimeTextPlain = "text/plain; " + CharsetUTF8 MimeMultipartForm = "multipart/form-data" MimeOctetStream = "application/octet-stream" )
Mime types
View Source
const (
CharsetUTF8 = "charset=utf8"
)
charsets
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface { context.Context AddValue(key, val interface{}) http.Hijacker http.ResponseWriter Writer() http.ResponseWriter SetWriter(http.ResponseWriter) RouteAll() map[string]string Route(name string) string RouteInt(name string) (int, error) RouteInt64(name string) (int64, error) RouteUint64(name string) (uint64, error) RouteTail() string Request() *http.Request RequestURI() string RequestRealIP() string RequestUserAgent() *user_agent.UserAgent RequestHost() (ip, port string) RequestPage(maxPageSize int) (page, size int) RequestJSON(dst interface{}) error RequestJSONForm(dst JSONCheck) bool RequestFormFile(name string, maxSize int64) (_ *MultipartFile, closer func(), tooLarge bool) StatusCode() int Writed() int WebSocket(handler func(*Socket)) WriteCookie(*http.Cookie) WriteBytes(code int, data []byte) error WriteString(code int, data string) error WriteStringf(code int, format string, v ...interface{}) error WriteStatus(code int) error WriteJSON(code int, data interface{}) error WritePage(data interface{}, total, size, num int) error WriteError(msg string) error WriteErrorJSON(data interface{}) error WriteNotFound() error WriteOK() error WriteCreated() error WriteCreatedID(id int) error WriteCreatedID64(id int64) error WriteNoContent() error WriteForbidden() error WriteBadRequest() error WriteRedirect(toURL string) error WriteHTML(code int, html string) error WriteHTMLBytes(code int, html []byte) error WriteHTMLTemplate(code int, tmpl *htemplate.Template, data interface{}) error WriteTextTemplate(code int, tmpl *ttemplate.Template, data interface{}) error WriteStream(code int, contentType string, r io.Reader) error WriteFile(filename string) error }
Context web
type MultipartFile ¶
type MultipartFile struct { multipart.File *multipart.FileHeader }
MultipartFile utils for save
func (*MultipartFile) SaveToDir ¶
func (mf *MultipartFile) SaveToDir(dir string) (path, filename string)
SaveToDir is alias Save with random name
type Router ¶
type Router interface { ServeHTTP(http.ResponseWriter, *http.Request) ViewConverter(func(interface{}) View) AddMiddleware(...interface{}) NotFound(view interface{}) Group(path string, sub func(Router)) Route(method, path string, view interface{}) Get(path string, view interface{}) Head(path string, view interface{}) Post(path string, view interface{}) Put(path string, view interface{}) Patch(path string, view interface{}) Delete(path string, view interface{}) Connect(path string, view interface{}) Options(path string, view interface{}) Trace(path string, view interface{}) Redirect(path, method, toURL string) File(path, filename string) Media(path, rootDir string) Static(path, rootDir string, compress bool) StaticFile(path, filename string, compress bool) }
Router http
Click to show internal directories.
Click to hide internal directories.