mirror of https://github.com/gofiber/fiber.git
v1.8.33
parent
bec9eecb29
commit
c7baaf6243
2
app.go
2
app.go
|
@ -25,7 +25,7 @@ import (
|
|||
)
|
||||
|
||||
// Version of Fiber
|
||||
const Version = "1.8.32"
|
||||
const Version = "1.8.33"
|
||||
|
||||
type (
|
||||
// App denotes the Fiber application.
|
||||
|
|
21
context.go
21
context.go
|
@ -36,8 +36,7 @@ type Ctx struct {
|
|||
values []string // Route parameter values
|
||||
compress bool // If the response needs to be compressed
|
||||
Fasthttp *fasthttp.RequestCtx // Reference to *fasthttp.RequestCtx
|
||||
Conn *Conn
|
||||
err error // Contains error if catched
|
||||
err error // Contains error if catched
|
||||
}
|
||||
|
||||
// Range struct
|
||||
|
@ -515,8 +514,11 @@ func (ctx *Ctx) Location(path string) {
|
|||
}
|
||||
|
||||
// Method : https://fiber.wiki/context#method
|
||||
func (ctx *Ctx) Method() string {
|
||||
return getString(ctx.Fasthttp.Request.Header.Method())
|
||||
func (ctx *Ctx) Method(override ...string) string {
|
||||
if len(override) > 0 {
|
||||
ctx.method = override[0]
|
||||
}
|
||||
return ctx.method
|
||||
}
|
||||
|
||||
// MultipartForm : https://fiber.wiki/context#multipartform
|
||||
|
@ -552,9 +554,14 @@ func (ctx *Ctx) Params(key string) (value string) {
|
|||
return
|
||||
}
|
||||
|
||||
// Path : https://fiber.wiki/context#path
|
||||
func (ctx *Ctx) Path() string {
|
||||
return getString(ctx.Fasthttp.URI().Path())
|
||||
// Returns the path part of the request URL.
|
||||
// Optionally, you could override the path.
|
||||
// https://fiber.wiki/context#path
|
||||
func (ctx *Ctx) Path(override ...string) string {
|
||||
if len(override) > 0 {
|
||||
ctx.path = override[0]
|
||||
}
|
||||
return ctx.path
|
||||
}
|
||||
|
||||
// Protocol : https://fiber.wiki/context#protocol
|
||||
|
|
|
@ -51,8 +51,7 @@ func (app *App) nextRoute(ctx *Ctx) {
|
|||
if err := websocketUpgrader.Upgrade(ctx.Fasthttp, func(fconn *websocket.Conn) {
|
||||
conn := acquireConn(fconn)
|
||||
defer releaseConn(conn)
|
||||
ctx.Conn = conn
|
||||
route.HandleCtx(ctx)
|
||||
route.HandleConn(conn)
|
||||
}); err != nil { // Upgrading failed
|
||||
ctx.SendStatus(400)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue