feat: Add statusCodeDetails info when returning response in Wasm plugins directly (#1116)

This commit is contained in:
Kent Dong
2024-07-16 09:52:46 +08:00
committed by GitHub
parent 85219b6c53
commit f069ad5b0d
111 changed files with 231 additions and 182 deletions

View File

@@ -154,7 +154,7 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config Config, log wrapper.Lo
err = compile.Validate(document)
if err != nil {
log.Errorf("validate request headers failed: %v", err)
proxywasm.SendHttpResponse(config.rejectedCode, nil, []byte(config.rejectedMsg), -1)
proxywasm.SendHttpResponseWithDetail(config.rejectedCode, "request-validation.invalid_headers", nil, []byte(config.rejectedMsg), -1)
return types.ActionPause
}
@@ -191,7 +191,7 @@ func onHttpRequestBody(ctx wrapper.HttpContext, config Config, body []byte, log
err = compile.Validate(document)
if err != nil {
log.Errorf("validate request body failed: %v", err)
proxywasm.SendHttpResponse(config.rejectedCode, nil, []byte(config.rejectedMsg), -1)
proxywasm.SendHttpResponseWithDetail(config.rejectedCode, "request-validation.invalid_body", nil, []byte(config.rejectedMsg), -1)
return types.ActionPause
}