mirror of
https://github.com/webx-top/echo
synced 2021-12-20 05:52:35 +00:00
136 lines
4.7 KiB
Go
136 lines
4.7 KiB
Go
/*
|
|
|
|
Copyright 2016 Wenhui Shen <www.webx.top>
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
package echo
|
|
|
|
import "path/filepath"
|
|
|
|
const (
|
|
// CONNECT HTTP method
|
|
CONNECT = "CONNECT"
|
|
// DELETE HTTP method
|
|
DELETE = "DELETE"
|
|
// GET HTTP method
|
|
GET = "GET"
|
|
// HEAD HTTP method
|
|
HEAD = "HEAD"
|
|
// OPTIONS HTTP method
|
|
OPTIONS = "OPTIONS"
|
|
// PATCH HTTP method
|
|
PATCH = "PATCH"
|
|
// POST HTTP method
|
|
POST = "POST"
|
|
// PUT HTTP method
|
|
PUT = "PUT"
|
|
// TRACE HTTP method
|
|
TRACE = "TRACE"
|
|
|
|
//-------------
|
|
// Media types
|
|
//-------------
|
|
|
|
MIMEApplicationJSON = "application/json"
|
|
MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + CharsetUTF8
|
|
MIMEApplicationJavaScript = "application/javascript"
|
|
MIMEApplicationJavaScriptCharsetUTF8 = MIMEApplicationJavaScript + "; " + CharsetUTF8
|
|
MIMEApplicationXML = "application/xml"
|
|
MIMEApplicationXMLCharsetUTF8 = MIMEApplicationXML + "; " + CharsetUTF8
|
|
MIMEApplicationForm = "application/x-www-form-urlencoded"
|
|
MIMEApplicationProtobuf = "application/protobuf"
|
|
MIMEApplicationMsgpack = "application/msgpack"
|
|
MIMETextHTML = "text/html"
|
|
MIMETextHTMLCharsetUTF8 = MIMETextHTML + "; " + CharsetUTF8
|
|
MIMETextPlain = "text/plain"
|
|
MIMETextPlainCharsetUTF8 = MIMETextPlain + "; " + CharsetUTF8
|
|
MIMETextJavaScript = "text/javascript"
|
|
MIMETextJavaScriptCharsetUTF8 = MIMETextJavaScript + "; " + CharsetUTF8
|
|
MIMETextCSS = "text/css"
|
|
MIMETextCSSCharsetUTF8 = MIMETextCSS + "; " + CharsetUTF8
|
|
MIMEMultipartForm = "multipart/form-data"
|
|
MIMEOctetStream = "application/octet-stream"
|
|
MIMEEventStream = "text/event-stream"
|
|
|
|
//---------
|
|
// Charset
|
|
//---------
|
|
|
|
CharsetUTF8 = "charset=utf-8"
|
|
|
|
//---------
|
|
// Headers
|
|
//---------
|
|
|
|
HeaderAccept = "Accept"
|
|
HeaderAcceptEncoding = "Accept-Encoding"
|
|
HeaderAllow = "Allow"
|
|
HeaderAuthorization = "Authorization"
|
|
HeaderContentDisposition = "Content-Disposition"
|
|
HeaderContentEncoding = "Content-Encoding"
|
|
HeaderContentLength = "Content-Length"
|
|
HeaderContentType = "Content-Type"
|
|
HeaderIfModifiedSince = "If-Modified-Since"
|
|
HeaderCookie = "Cookie"
|
|
HeaderSetCookie = "Set-Cookie"
|
|
HeaderLastModified = "Last-Modified"
|
|
HeaderLocation = "Location"
|
|
HeaderUpgrade = "Upgrade"
|
|
HeaderVary = "Vary"
|
|
HeaderWWWAuthenticate = "WWW-Authenticate"
|
|
HeaderXForwardedProto = "X-Forwarded-Proto"
|
|
HeaderXForwardedPort = "X-Forwarded-Port"
|
|
HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
|
|
HeaderXForwardedFor = "X-Forwarded-For"
|
|
HeaderXRealIP = "X-Real-IP"
|
|
HeaderXRequestID = "X-Request-ID"
|
|
HeaderXRequestedWith = "X-Requested-With"
|
|
HeaderServer = "Server"
|
|
HeaderOrigin = "Origin"
|
|
HeaderCacheControl = "Cache-Control"
|
|
|
|
// Access control
|
|
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"
|
|
|
|
// Security
|
|
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"
|
|
|
|
FilePathSeparator = string(filepath.Separator)
|
|
|
|
// Content Type
|
|
ContentTypeHTML = "html"
|
|
ContentTypeJSON = "json"
|
|
ContentTypeJSONP = "jsonp"
|
|
ContentTypeXML = "xml"
|
|
ContentTypeText = "text"
|
|
|
|
// HTTP Scheme
|
|
SchemeHTTP = "http"
|
|
SchemeHTTPS = "https"
|
|
)
|