okhttp

package
v0.0.0-...-cdc279e Latest Latest
Warning

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

Go to latest
Published: Jan 9, 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 OKHttp

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

func New

func New() *OKHttp

func (*OKHttp) DELETE

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

DELETE DELETE

func (*OKHttp) GET

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

GET GET

func (*OKHttp) GetGinRoute

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

GetGinRoute GetGinRoute

func (*OKHttp) Group

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

Group Group

func (*OKHttp) LMHttpHandler

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

LMHttpHandler LMHttpHandler

func (*OKHttp) POST

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

POST POST

func (*OKHttp) Run

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

Run Run

func (*OKHttp) ServeHTTP

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

func (*OKHttp) Static

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

Static Static

func (*OKHttp) Use

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

Use Use

Jump to

Keyboard shortcuts

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