mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 20:17:29 +08:00
feat: Add statusCodeDetails info when returning response in Wasm plugins directly (#1116)
This commit is contained in:
@@ -44,7 +44,7 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config Config, log wrapper.Lo
|
||||
res.Code = http.StatusBadRequest
|
||||
res.Msg = "token or secret 不允许为空"
|
||||
data, _ := json.Marshal(res)
|
||||
_ = proxywasm.SendHttpResponse(http.StatusUnauthorized, nil, data, -1)
|
||||
_ = proxywasm.SendHttpResponseWithDetail(http.StatusUnauthorized, "simple-jwt-auth.bad_config", nil, data, -1)
|
||||
return types.ActionContinue
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config Config, log wrapper.Lo
|
||||
res.Code = http.StatusUnauthorized
|
||||
res.Msg = "认证失败"
|
||||
data, _ := json.Marshal(res)
|
||||
_ = proxywasm.SendHttpResponse(http.StatusUnauthorized, nil, data, -1)
|
||||
_ = proxywasm.SendHttpResponseWithDetail(http.StatusUnauthorized, "simple-jwt-auth.auth_failed", nil, data, -1)
|
||||
return types.ActionContinue
|
||||
}
|
||||
valid := ParseTokenValid(token, config.TokenSecretKey)
|
||||
@@ -63,7 +63,7 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config Config, log wrapper.Lo
|
||||
res.Code = http.StatusUnauthorized
|
||||
res.Msg = "认证失败"
|
||||
data, _ := json.Marshal(res)
|
||||
_ = proxywasm.SendHttpResponse(http.StatusUnauthorized, nil, data, -1)
|
||||
_ = proxywasm.SendHttpResponseWithDetail(http.StatusUnauthorized, "simple-jwt-auth.auth_failed", nil, data, -1)
|
||||
return types.ActionContinue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user