-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Feature Request: In lua http filter add ability to set the contents of the body #5998
Comments
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or other activity occurs. Thank you for your contributions. |
Please do not close this feature request. The request is still relevant. |
@DevoKun gotcha! |
I was just trying to implement this in order to fix the issue with grpc-json transcoder not placing error messages and codes in the body. #3383 |
Hi, are there any updates to this issue? I found a use case for this feature as well and would love to know what the status is for this feature request |
+1 |
The use case that I need this feature for is: User specifies the HTTP header Similarly, I would like to update the request body so that I can allow users to submit requests using different encodings and handle them all as UTF-8 internally. |
One way to fix this is to make Hence we can do: - name: envoy.filters.http.lua
typed_config:
"@type": type.googleapis.com/envoy.config.filter.http.lua.v2.Lua
inline_code: |
function envoy_on_request(request_handle)
end
function envoy_on_response(response_handle)
response_handle:headers():replace("content-length", 6)
response_handle:body():set("hello\n")
end Notice that we need to know the content_length = response_handle:body():set("hello\n")
response_handle:headers():replace("content-length", content_length) But it is not possible for now. Another way is to implement full-blown cc. @ceastman-ibm |
@mattklein123 do you think it is OK to let |
From a quick glance it seems reasonable. Let's discuss in code review? re: content-length, you should also be able to clear it and switch to chunk encoding if necessary. I would definitely have documentation/example about that. |
I have submitted a PR (#13172) for this. Not entirely sure, probably we can repurpose the |
This patch adds `setBytes()` API to the buffer wrapper by making the wrapped buffer to be mutable. This allows rewriting upstream data in the response path. Risk Level: Low Testing: Added unit and integration tests. Docs Changes: Added Release Notes: Added Fixes #5998 Signed-off-by: Dhi Aurrahman <[email protected]>
Feature Request: In lua http filter add ability to set the contents of the body
The text was updated successfully, but these errors were encountered: