Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ContentBinaryHeaderValue header value for binary data. ContentBinaryHeaderValue = "application/octet-stream" // ContentWebassemblyHeaderValue header value for web assembly files. ContentWebassemblyHeaderValue = "application/wasm" // ContentHTMLHeaderValue is the string of text/html response header's content type value. ContentHTMLHeaderValue = "text/html" // ContentJSONHeaderValue header value for JSON data. ContentJSONHeaderValue = "application/json" // ContentJSONProblemHeaderValue header value for JSON API problem error. // Read more at: https://tools.ietf.org/html/rfc7807 ContentJSONProblemHeaderValue = "application/problem+json" // ContentXMLProblemHeaderValue header value for XML API problem error. // Read more at: https://tools.ietf.org/html/rfc7807 ContentXMLProblemHeaderValue = "application/problem+xml" // ContentJavascriptHeaderValue header value for JSONP & Javascript data. ContentJavascriptHeaderValue = "application/javascript" // ContentTextHeaderValue header value for Text data. ContentTextHeaderValue = "text/plain" // ContentXMLHeaderValue header value for XML data. ContentXMLHeaderValue = "text/xml" // ContentXMLUnreadableHeaderValue obselete header value for XML. ContentXMLUnreadableHeaderValue = "application/xml" // ContentMarkdownHeaderValue custom key/content type, the real is the text/html. ContentMarkdownHeaderValue = "text/markdown" // ContentYAMLHeaderValue header value for YAML data. ContentYAMLHeaderValue = "application/x-yaml" // ContentFormHeaderValue header value for post form data. ContentFormHeaderValue = "application/x-www-form-urlencoded" // ContentFormMultipartHeaderValue header value for post multipart form data. ContentFormMultipartHeaderValue = "multipart/form-data" //need additional implement ContentRedirect = "redirect" )
View Source
const (
ContentTypeHeaderKey string = "Content-Type"
)
Variables ¶
This section is empty.
Functions ¶
func ContentType ¶
func SetContentType ¶
func SetContentType(w http.ResponseWriter, cType string)
Types ¶
type Response ¶
type Response interface { //build response Status(httpCode int) Response Data(data interface{}) Response Message(msg string) Response ContentType(cType string) Response GetStatus() int GetData() interface{} GetMessage() string GetContentType() string //set content-type Html() Response YAML() Response XML() Response TEXT() Response //write value Write(w http.ResponseWriter) WriteHtml(w http.ResponseWriter) WriteYAML(w http.ResponseWriter) WriteXML(w http.ResponseWriter) WriteTEXT(w http.ResponseWriter) //refer http action Forward(w http.ResponseWriter) }
func BadRequest ¶
func InternalError ¶
Click to show internal directories.
Click to hide internal directories.