Skip to content

Commit

Permalink
fix handler_server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
fengyuan-liang committed Jul 15, 2024
1 parent dc6eb4c commit 78f72f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/handler/handler_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func parseReqDefault(ctx *fasthttp.RequestCtx, param reflect.Value, args []strin
}
if isJsonCall(&ctx.Request) {
if ctx.Request.Header.ContentLength() <= 0 || len(ctx.Request.Body()) <= 0 {
return
return parseValue(param, ctx, "form")
}
return utils.ByteToObj(ctx.Request.Body(), param.Interface())
} else if isFormCall(&ctx.Request) {
Expand Down
3 changes: 3 additions & 0 deletions jet/jet_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package jet

import (
"fmt"
"github.com/fengyuan-liang/jet-web-fasthttp/core/handler"
"github.com/fengyuan-liang/jet-web-fasthttp/core/router"
"github.com/fengyuan-liang/jet-web-fasthttp/pkg/utils"
Expand Down Expand Up @@ -43,6 +44,8 @@ func RecoverJetMiddleware(next router.IJetRouter) (router.IJetRouter, error) {
if err := recover(); err != nil {
handler.FailServerInternalErrorHandler(ctx, "Internal Server Error")
utils.PrintPanicInfo("Your server has experienced a panic, please check the stack log below")
fmt.Printf("Panic: %v\n", err)
fmt.Printf("stack info\n")
debug.PrintStack()
}
}()
Expand Down

0 comments on commit 78f72f1

Please sign in to comment.