-
Notifications
You must be signed in to change notification settings - Fork 83
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
Ensure request body is correctly propagated in Nighthawk Request Source. #1289
Merged
eric846
merged 19 commits into
envoyproxy:main
from
Pelinthecoder:feature/propagate-json-body-to-plugins
Feb 13, 2025
Merged
Ensure request body is correctly propagated in Nighthawk Request Source. #1289
eric846
merged 19 commits into
envoyproxy:main
from
Pelinthecoder:feature/propagate-json-body-to-plugins
Feb 13, 2025
+38
−4
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously, requests generated by `OptionsListRequestSource` did not correctly set the request body, leading to empty payloads when using `json_body`. This CL ensures that `json_body` is correctly propagated from `RequestOptionsList` to `RequestImpl`, aligning request behavior with expectations. ### Changes: - **Updated Request interface (`request.h`)**: Added `body()` as a pure virtual method. - **Modified `RequestImpl` (`request_impl.h` & `request_impl.cc`)**: - Updated the constructor to accept `json_body_` as an argument. - Implemented `body()` to return `json_body_` instead of an empty string. - **Fixed `OptionsListRequestSource::get()`**: - Now correctly assigns `json_body` when creating `RequestImpl`. - Ensures request bodies are set properly instead of being empty. - **Fixed `RemoteRequestSourceImpl::get()`**: - Ensures that request bodies from gRPC sources are also correctly populated. - **Updated `request_source_plugin_test.cc`**: - Modified tests to verify that `request3->body()` is correctly set. - Ensured `request3` is not `nullptr` and contains the expected `json_body`. ### **Why This Change?** Without this fix, request bodies remain empty despite being set in the configuration (`RequestOptionsList`). This caused inconsistencies in request generation. This CL ensures that the body is always populated correctly, improving reliability. ### **Testing:** - Verified that `json_body` is correctly loaded from the YAML file. - Confirmed `request3->body()` now returns the expected JSON payload. - Ran tests on Cider-V, all passed successfully. This change ensures that request generation works as expected and aligns with the intended behavior. Signed-off-by: pelinthecoder <[email protected]>
The description refers to changes in |
eric846
reviewed
Feb 10, 2025
eric846
reviewed
Feb 10, 2025
Pelinthecoder
commented
Feb 11, 2025
🙀 Error while processing event:
|
fei-deng
reviewed
Feb 11, 2025
Signed-off-by: Pelinthecoder <[email protected]>
Signed-off-by: Pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
fei-deng
reviewed
Feb 11, 2025
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
…son-body-to-plugins Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
eric846
reviewed
Feb 12, 2025
Signed-off-by: pelinthecoder <[email protected]>
Pelinthecoder
commented
Feb 12, 2025
🙀 Error while processing event:
|
fei-deng
reviewed
Feb 12, 2025
Signed-off-by: pelinthecoder <[email protected]>
Signed-off-by: pelinthecoder <[email protected]>
eric846
approved these changes
Feb 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, requests generated by
OptionsListRequestSource
did not correctly set the request body, leading to empty payloads when usingjson_body
. This CL ensures thatjson_body
is correctly propagated fromRequestOptionsList
toRequestImpl
, aligning request behavior with expectations.Changes:
request.h
): Addedbody()
as a pure virtual method.RequestImpl
(request_impl.h
&request_impl.cc
):json_body_
as an argument.body()
to returnjson_body_
instead of an empty string.OptionsListRequestSource::get()
:json_body
when creatingRequestImpl
.RemoteRequestSourceImpl::get()
:request_source_plugin_test.cc
:request3->body()
is correctly set.request3
is notnullptr
and contains the expectedjson_body
.Why This Change?
Without this fix, request bodies remain empty despite being set in the configuration (
RequestOptionsList
). This caused inconsistencies in request generation. This CL ensures that the body is always populated correctly, improving reliability.Testing:
json_body
is correctly loaded from the YAML file.request3->body()
now returns the expected JSON payload.This change ensures that request generation works as expected and aligns with the intended behavior.