Documentation
¶
Index ¶
- Constants
- func ReqTo(r *http.Request, obj any) error
- func ReqToJSON(r *http.Request, obj any) error
- func ReqToPB(r *http.Request, obj any) error
- func ReqToTOML(r *http.Request, obj any) error
- func ReqToXML(r *http.Request, obj any) error
- func ReqToYAML(r *http.Request, obj any) error
- func Resp(w http.ResponseWriter, statusCode int, data any, headersKV ...string)
- func RespEncoder(w http.ResponseWriter, statusCode int, data any, mime string, ...)
- func RespFail(data any, w http.ResponseWriter, headersKV ...string)
- func RespJSON(w http.ResponseWriter, statusCode int, data any, headersKV ...string)
- func RespJSONFail(w http.ResponseWriter, data any, headersKV ...string)
- func RespJSONOk(w http.ResponseWriter, data any, headersKV ...string)
- func RespOk(data any, w http.ResponseWriter, headersKV ...string)
- func RespRaw(w http.ResponseWriter, statusCode int, data []byte, headersKV ...string)
- func RespRawFail(data []byte, w http.ResponseWriter, headersKV ...string)
- func RespRawOk(data []byte, w http.ResponseWriter, headersKV ...string)
- func RespReader(w http.ResponseWriter, statusCode int, r io.Reader, headersKV ...string)
- func RespReaderFail(w http.ResponseWriter, r io.Reader, headersKV ...string)
- func RespReaderOk(w http.ResponseWriter, r io.Reader, headersKV ...string)
- type Encoder
- type NewEncoder
Constants ¶
View Source
const ( HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" MIMEHTML = "text/html" MIMEHTMLUTF8 = "text/html; charset=utf-8" MIMEJSON = "application/json" MIMEJSONUTF8 = "application/json; charset=utf-8" MIMEXML = "application/xml" MIMEXML2 = "text/xml" MIMEPlain = "text/plain" MIMEPlainUTF8 = "text/plain; charset=utf-8" MIMEPOSTForm = "application/x-www-form-urlencoded" MIMEMultipartPOSTForm = "multipart/form-data" MIMEPROTOBUF = "application/x-protobuf" MIMEMSGPACK = "application/x-msgpack" MIMEMSGPACK2 = "application/msgpack" MIMEYAML = "application/x-yaml" MIMEYAML2 = "application/yaml" MIMETOML = "application/toml" )
Variables ¶
This section is empty.
Functions ¶
func RespEncoder ¶ added in v0.10.0
func RespEncoder(w http.ResponseWriter, statusCode int, data any, mime string, newEncoder NewEncoder, headersKV ...string)
func RespJSONFail ¶
func RespJSONFail(w http.ResponseWriter, data any, headersKV ...string)
func RespJSONOk ¶
func RespJSONOk(w http.ResponseWriter, data any, headersKV ...string)
func RespRaw ¶
func RespRaw(w http.ResponseWriter, statusCode int, data []byte, headersKV ...string)
func RespRawFail ¶
func RespRawFail(data []byte, w http.ResponseWriter, headersKV ...string)
func RespReader ¶ added in v0.10.0
func RespReaderFail ¶ added in v0.10.0
func RespReaderFail(w http.ResponseWriter, r io.Reader, headersKV ...string)
func RespReaderOk ¶ added in v0.10.0
func RespReaderOk(w http.ResponseWriter, r io.Reader, headersKV ...string)
Types ¶
type NewEncoder ¶ added in v0.10.0
Click to show internal directories.
Click to hide internal directories.