wkhttp

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	*gin.Context
}

func (*Context) CopyRequestHeader

func (c *Context) CopyRequestHeader(request *http.Request) map[string]string

CopyRequestHeader 复制request的header参数

func (*Context) Forward

func (c *Context) Forward(url string)

Forward 转发请求

func (*Context) ForwardWithBody

func (c *Context) ForwardWithBody(url string, body []byte)

ForwardWithBody 转发请求

func (*Context) ResponseData

func (c *Context) ResponseData(status int, data interface{})

ResponseData 返回状态和数据

func (*Context) ResponseError

func (c *Context) ResponseError(err error)

ResponseError ResponseError

func (*Context) ResponseOK

func (c *Context) ResponseOK()

ResponseOK 返回正确

func (*Context) ResponseOKWithData

func (c *Context) ResponseOKWithData(data interface{})

ResponseOKWithData 返回正确并并携带数据

func (*Context) ResponseStatus

func (c *Context) ResponseStatus(status int)

ResponseStatus 返回状态

type HandlerFunc

type HandlerFunc func(c *Context)

HandlerFunc HandlerFunc

func CORSMiddleware

func CORSMiddleware() HandlerFunc

CORSMiddleware 跨域

type WKHttp

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

func New

func New() *WKHttp

func (*WKHttp) DELETE

func (l *WKHttp) DELETE(relativePath string, handlers ...HandlerFunc)

DELETE DELETE

func (*WKHttp) GET

func (l *WKHttp) GET(relativePath string, handlers ...HandlerFunc)

GET GET

func (*WKHttp) GetGinRoute

func (l *WKHttp) GetGinRoute() *gin.Engine

GetGinRoute GetGinRoute

func (*WKHttp) Group

func (l *WKHttp) Group(relativePath string, handlers ...HandlerFunc)

Group Group

func (*WKHttp) LMHttpHandler

func (l *WKHttp) LMHttpHandler(handlerFunc HandlerFunc) gin.HandlerFunc

LMHttpHandler LMHttpHandler

func (*WKHttp) POST

func (l *WKHttp) POST(relativePath string, handlers ...HandlerFunc)

POST POST

func (*WKHttp) Run

func (l *WKHttp) Run(addr ...string) error

Run Run

func (*WKHttp) ServeHTTP

func (l *WKHttp) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*WKHttp) Static

func (l *WKHttp) Static(relativePath string, root string)

Static Static

func (*WKHttp) Use

func (l *WKHttp) Use(handlers ...HandlerFunc)

Use Use

Jump to

Keyboard shortcuts

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