Response validation failed with empty content type
mx237 opened this issue · 1 comments
mx237 commented
I set APIFW_RESPONSE_VALIDATION=BLOCK
and got the following error:
level=error msg=response validation error error=response header Content-Type has unexpected value: "" request_id=#0000000100000001
I suspect it's due to this code in cmd/api-firewall/internal/handlers/openapi.go
// Prepare http response headers
respHeader := http.Header{}
ctx.Request.Header.VisitAll(func(k, v []byte) {
sk := string(k)
sv := string(v)
respHeader.Set(sk, sv)
})
It seems to obtain the http headers from request rather than response. Should ctx.Request
be changed to ctx.Response
?
afr1ka commented
Hello mx237,
Yes, you are right. Will be fixed in 0.6.11.
Thanks