httpx

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationJson = "application/json"
	ContentEncoding = "Content-Encoding"
	ContentSecurity = "X-Content-Security"
	ContentType     = "Content-Type"
	KeyField        = "key"
	SecretField     = "secret"
	TypeField       = "type"
	CryptionType    = 1
)
View Source
const (
	CodeSignaturePass = iota
	CodeSignatureInvalidHeader
	CodeSignatureWrongTime
	CodeSignatureInvalidToken
)

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, err error)

func GetRemoteAddr added in v1.0.1

func GetRemoteAddr(r *http.Request) string

Returns the peer address, supports X-Forward-For

func Ok

func Ok(w http.ResponseWriter)

func OkJson

func OkJson(w http.ResponseWriter, v interface{})

func Parse

func Parse(r *http.Request, v interface{}) error

func ParseForm

func ParseForm(r *http.Request, v interface{}) error

Parses the form request.

func ParseHeader

func ParseHeader(headerValue string) map[string]string

func ParseJsonBody

func ParseJsonBody(r *http.Request, v interface{}) error

Parses the post request which contains json in body.

func ParsePath

func ParsePath(r *http.Request, v interface{}) error

Parses the symbols reside in url path. Like http://localhost/bag/:name

func SetErrorHandler added in v1.0.28

func SetErrorHandler(handler func(error) (int, interface{}))

func WriteJson

func WriteJson(w http.ResponseWriter, code int, v interface{})

Types

type Router

type Router interface {
	http.Handler
	Handle(method string, path string, handler http.Handler) error
	SetNotFoundHandler(handler http.Handler)
	SetNotAllowedHandler(handler http.Handler)
}

Jump to

Keyboard shortcuts

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