-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve BufferOptions (body, json_body) #680
Comments
We could create a new BufferOption for JSON-parsing apart from However, looking at Test_StoreInvalidBackendResponse with its configuration testdata/integration/error_handler/06_couper.hcl: server {
api {
endpoint "/anything" {
proxy {
backend {
origin = "${env.COUPER_TEST_BACKEND_ADDR}"
openapi {
file = "02_schema.yaml"
}
}
}
}
error_handler "backend_openapi_validation" {
response {
status = 418
json_body = {
req_path = backend_requests.default.path
resp_status = backend_responses.default.status
resp_json_body_query = backend_responses.default.json_body.Query
resp_ct = backend_responses.default.headers.content-type
}
}
}
}
} , the error handler gets its own This test works, because both BufferOpts have If we consider another configuration server {
api {
endpoint "/anything" {
request "r" {
url = "https://blackhole.webpagetest.org/"
backend {
timeout = "1s"
}
}
proxy {
backend {
origin = "https://httpbin.org"
}
}
}
error_handler "backend_timeout" {
response {
status = 418
json_body = {
resp_json_body_headers = backend_responses.default.json_body.headers
}
}
}
}
} , the error handler's BufferOpts are |
blocked by #706 |
I agree on skipping the JSON-parsing with json_body = {
a = backend_responses.a.json_body
} |
To further optimize the memory and cpu consumption we should determine an explicit usage of body or json_body content for its request context. We should skip parsing and converting to cty.Object if just the
.body
or.json_body
gets passed without accessing any properties. Also the sequence usage of the mentioned root variables could just get piped to the next item.The text was updated successfully, but these errors were encountered: