Documentation
¶
Index ¶
- Constants
- func GetRealRemoteIP(r *http.Request) string
- 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 RespAny(w http.ResponseWriter, statusCode int, a any, headersKV ...string)
- func RespBytes(w http.ResponseWriter, statusCode int, bs []byte, headersKV ...string)
- func RespEncoder(w http.ResponseWriter, statusCode int, data any, mime string, ...)
- func RespJSON(w http.ResponseWriter, statusCode int, data any, headersKV ...string)
- func RespReader(w http.ResponseWriter, statusCode int, r io.Reader, headersKV ...string)
- func RespString(w http.ResponseWriter, statusCode int, str string, headersKV ...string)
- func RespYAML(w http.ResponseWriter, statusCode int, data any, headersKV ...string)
- type Decoder
- type Encoder
- type NewDecoder
- type NewEncoder
- type RecordResponseWriter
- func (rp *RecordResponseWriter) Flush()
- func (rp *RecordResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
- func (rp *RecordResponseWriter) Size() int
- func (rp *RecordResponseWriter) Status() int
- func (rp *RecordResponseWriter) Write(data []byte) (int, error)
- func (rp *RecordResponseWriter) WriteHeader(statusCode int)
- func (rp *RecordResponseWriter) Written() bool
Constants ¶
View Source
const ( HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" HeaderAcceptRanges = "Accept-Ranges" HeaderAuthorization = "Authorization" HeaderDate = "Date" HeaderContentEncoding = "Content-Encoding" HeaderContentLanguage = "Content-Language" HeaderContentMD5 = "Content-MD5" HeaderIfModifiedSince = "If-Modified-Since" HeaderIfMatch = "If-Match" HeaderIfNoneMatch = "If-None-Match" HeaderIfUnmodifiedSince = "If-Unmodified-Since" HeaderRange = "Range" HeaderTransferEncoding = "Transfer-Encoding" HeaderServer = "Server" HeaderUserAgent = "User-Agent" HeaderAccept = "Accept" 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 GetRealRemoteIP ¶ added in v0.11.30
func RespAny ¶ added in v0.13.0
func RespAny(w http.ResponseWriter, statusCode int, a any, headersKV ...string)
func RespBytes ¶ added in v0.13.0
func RespBytes(w http.ResponseWriter, statusCode int, bs []byte, headersKV ...string)
func RespEncoder ¶ added in v0.10.0
func RespEncoder(w http.ResponseWriter, statusCode int, data any, mime string, newEncoder NewEncoder, headersKV ...string)
func RespReader ¶ added in v0.10.0
func RespString ¶ added in v0.13.0
func RespString(w http.ResponseWriter, statusCode int, str string, headersKV ...string)
Types ¶
type NewDecoder ¶ added in v0.10.4
type NewEncoder ¶ added in v0.10.0
type RecordResponseWriter ¶ added in v0.13.0
type RecordResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
func NewRecordResponseWriter ¶ added in v0.13.0
func NewRecordResponseWriter(w http.ResponseWriter) *RecordResponseWriter
func (*RecordResponseWriter) Flush ¶ added in v0.13.0
func (rp *RecordResponseWriter) Flush()
func (*RecordResponseWriter) Hijack ¶ added in v0.13.0
func (rp *RecordResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*RecordResponseWriter) Size ¶ added in v0.13.0
func (rp *RecordResponseWriter) Size() int
func (*RecordResponseWriter) Status ¶ added in v0.13.0
func (rp *RecordResponseWriter) Status() int
func (*RecordResponseWriter) Write ¶ added in v0.13.0
func (rp *RecordResponseWriter) Write(data []byte) (int, error)
func (*RecordResponseWriter) WriteHeader ¶ added in v0.13.0
func (rp *RecordResponseWriter) WriteHeader(statusCode int)
func (*RecordResponseWriter) Written ¶ added in v0.13.0
func (rp *RecordResponseWriter) Written() bool
Click to show internal directories.
Click to hide internal directories.