update
This commit is contained in:
parent
b15fa3f709
commit
6659671132
@ -50,6 +50,8 @@ func (a *Auth) Handler() fiber.Handler {
|
||||
|
||||
authorization := c.Get(constants.AuthHeader)
|
||||
|
||||
r.Status(http.StatusUnauthorized)
|
||||
|
||||
if authorization == "" {
|
||||
return r.Error(errs.JWTFormatError).Send()
|
||||
}
|
||||
@ -66,11 +68,11 @@ func (a *Auth) Handler() fiber.Handler {
|
||||
token, err = a.authService.AuthFromToken(constants.JwtTokenTypeIDToken, authSplit[1])
|
||||
|
||||
if err != nil {
|
||||
return r.Error(err).Status(http.StatusUnauthorized).Send()
|
||||
return r.Error(err).Send()
|
||||
}
|
||||
|
||||
if token == nil {
|
||||
return r.Error(err).Status(http.StatusUnauthorized).Send()
|
||||
return r.Error(err).Send()
|
||||
}
|
||||
|
||||
if audienceLength > 0 {
|
||||
|
@ -111,16 +111,12 @@ func (r *Response) Send() error {
|
||||
var rspCtx = r.ctx.Status(r.httpStatus)
|
||||
var rspErr error
|
||||
|
||||
if r.body.Data == nil {
|
||||
return rspCtx.Send([]byte{})
|
||||
}
|
||||
|
||||
if r.body.Wrap {
|
||||
if r.body.Data == nil || r.body.Wrap {
|
||||
rspErr = rspCtx.JSON(r.body)
|
||||
} else {
|
||||
rspErr = rspCtx.JSON(r.body.Data)
|
||||
}
|
||||
|
||||
rspErr = rspCtx.JSON(r.body.Data)
|
||||
|
||||
return rspErr
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user