httpu

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 10 Imported by: 3

Documentation

Index

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"
	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 ReqToJSON added in v0.7.0

func ReqToJSON(r *http.Request, obj interface{}) error

func ReqToPB added in v0.7.0

func ReqToPB(r *http.Request, obj interface{}) error

func ReqToTOML added in v0.7.0

func ReqToTOML(r *http.Request, obj interface{}) error

func ReqToXML added in v0.7.0

func ReqToXML(r *http.Request, obj interface{}) error

func ReqToYAML added in v0.7.0

func ReqToYAML(r *http.Request, obj interface{}) error

func Resp

func Resp(statusCode int, data interface{}, w http.ResponseWriter, headersKV ...string)

func RespFail

func RespFail(data interface{}, w http.ResponseWriter, headersKV ...string)

func RespHTML

func RespHTML(statusCode int, data []byte, w http.ResponseWriter, headersKV ...string)

func RespHTMLFail

func RespHTMLFail(data []byte, w http.ResponseWriter, headersKV ...string)

func RespHTMLOk

func RespHTMLOk(data []byte, w http.ResponseWriter, headersKV ...string)

func RespJSON

func RespJSON(statusCode int, data interface{}, w http.ResponseWriter, headersKV ...string)

func RespJSONFail

func RespJSONFail(data interface{}, w http.ResponseWriter, headersKV ...string)

func RespJSONOk

func RespJSONOk(data interface{}, w http.ResponseWriter, headersKV ...string)

func RespOk

func RespOk(data interface{}, w http.ResponseWriter, headersKV ...string)

func RespRaw

func RespRaw(statusCode int, data []byte, w http.ResponseWriter, headersKV ...string)

func RespRawFail

func RespRawFail(data []byte, w http.ResponseWriter, headersKV ...string)

func RespRawOk

func RespRawOk(data []byte, w http.ResponseWriter, headersKV ...string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL