http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultStatic = NewStatic()
)

Functions

func AddHttpHandle

func AddHttpHandle(f intercept.HttpIntercept)

func DoHttp

func DoHttp(rw http.ResponseWriter, req *http.Request)

func NewApiIntercept

func NewApiIntercept(match def.Match, caller def.Caller, serialize def.Serialize, pool *def.MethodsPools) intercept.HttpIntercept

func RegisterErrorHandler

func RegisterErrorHandler(p reflect.Type, handler ErrorHandler)

func RegisterReturnHandler

func RegisterReturnHandler(ret def.RetAdapter)

func WriteError

func WriteError(err any, rw http.ResponseWriter)

func WriteResponse

func WriteResponse(rw http.ResponseWriter, req *http.Request, content *def.Content)

func WriteRetResponse

func WriteRetResponse(rw http.ResponseWriter, req *http.Request, adapter def.RetAdapter)

Types

type ApiInter

type ApiInter struct {
	// contains filtered or unexported fields
}

func (*ApiInter) Http

func (api *ApiInter) Http(rw http.ResponseWriter, req *http.Request, ctx *intercept.HttpContext) bool

func (*ApiInter) Order

func (api *ApiInter) Order() def.HandlerOrder

type ApiRespose added in v0.1.0

type ApiRespose struct {
}

func NewApiRespose added in v0.1.0

func NewApiRespose() *ApiRespose

func (*ApiRespose) Http added in v0.1.0

func (resp *ApiRespose) Http(rw http.ResponseWriter, req *http.Request, ctx *intercept.HttpContext) bool

Http implements intercept.HttpIntercept.

func (*ApiRespose) Order added in v0.1.0

func (*ApiRespose) Order() def.HandlerOrder

Order implements intercept.HttpIntercept.

type ErrorHandler

type ErrorHandler func(err interface{}) interface{}

type Handles

type Handles []intercept.HttpIntercept

func (Handles) Sort added in v0.1.0

func (h Handles) Sort()

type NotFind added in v0.1.0

type NotFind struct {
	// contains filtered or unexported fields
}

func NewNotFind added in v0.1.0

func NewNotFind(serialize def.Serialize) *NotFind

func (*NotFind) Http added in v0.1.0

func (n *NotFind) Http(rw http.ResponseWriter, req *http.Request, ctx *intercept.HttpContext) bool

Http implements intercept.HttpIntercept.

func (*NotFind) Order added in v0.1.0

func (*NotFind) Order() def.HandlerOrder

Order implements intercept.HttpIntercept.

type Static added in v0.1.0

type Static struct {
	// contains filtered or unexported fields
}

func NewStatic added in v0.1.0

func NewStatic() *Static

func (*Static) HandleStatic added in v0.1.0

func (s *Static) HandleStatic(path, dirPath string, fileSystem http.FileSystem, sOps ...StaticOption)

HandleStatic path is the mapping url dirPath is the real path fileSystem open[ join(path + dirPath) ]

func (*Static) Http added in v0.1.0

func (s *Static) Http(rw http.ResponseWriter, req *http.Request, ctx *intercept.HttpContext) bool

func (*Static) Order added in v0.1.0

func (s *Static) Order() def.HandlerOrder

type StaticOps added in v0.1.0

type StaticOps interface {
	Rewrite(orig string, replace string)
	DefaultFile(file string)
}

type StaticOption added in v0.1.0

type StaticOption func(StaticOps)

func StaticDefaultFile added in v0.1.0

func StaticDefaultFile(file string) StaticOption

func StaticRewrite added in v0.1.0

func StaticRewrite(orig string, replace string) StaticOption

Jump to

Keyboard shortcuts

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