Add echo_request_headers to the test server filter ResponseOptions.#338
Add echo_request_headers to the test server filter ResponseOptions.#338mum4k merged 10 commits intoenvoyproxy:masterfrom
Conversation
|
@htuch PTAL when you have a chance. |
Requests with this path get response with the dump of request headers instead of generated output. Signed-off-by: Misha Efimov <mef@google.com>
Signed-off-by: Misha Efimov <mef@google.com>
oschaaf
left a comment
There was a problem hiding this comment.
Some drive-by comments:
This looks like a great feature to me, some thoughts:
- Maybe an option to allow people to configure
/echoheaderswould be nice-to-have.
(It would also allow an escape latch in the (highly unlikely) event someone needs this path to function like it did before this change) - A note in
README.mdwould help make this feature discoverable by others.
Excellent, thanks for your suggestions!
The current implementation is inspired by Chromium's Embedded Test Server [1] that is mostly used in net and cronet [2] unit tests. Your suggestion made me realize that in Nighthawk it will be better to configure special handlers using config instead of pre-defined request path. This way echo behaviors can be configured per individual request, applied to any request path, and combined if necessary (for example, echo headers and echo metadata). I'll update the PR.
Absolutely! I just wanted to flesh out the implementation before updating the docs. [1] https://source.chromium.org/chromium/chromium/src/+/master:net/test/embedded_test_server/embedded_test_server.h |
Signed-off-by: Misha Efimov <mef@google.com>
Signed-off-by: Misha Efimov <mef@google.com>
htuch
left a comment
There was a problem hiding this comment.
LGTM, but do you want to talk about the motivation in the README.md? I.e. why would I set this as a Nighthawk user?
Signed-off-by: Misha Efimov <mef@google.com>
Signed-off-by: Misha Efimov <mef@google.com>
|
Thanks for the suggestion! |
|
On related note, after this PR I'd like to add more response options that I think might be useful:
WDYT? |
mum4k
left a comment
There was a problem hiding this comment.
Thank you for adding this feature and improving the documentation.
Signed-off-by: Misha Efimov <mef@google.com>
efimki
left a comment
There was a problem hiding this comment.
Thanks for your comments, please take a look.
Maybe? I haven't really thought this through yet. |
|
Thank you @efimki for addressing my comments, this looks good in regards to test coverage. I think @htuch raises a good point. I do agree that we shouldn't implement anything prematurely, however this might be the only time to introduce any structure, since we have a backward compatibility guarantee in the Nighthawk repository. Should we consider at least adding an inner structure (proto definition?) that will for now contain these headers only? |
|
@efimki can you please push a commit (or two) to kick the CI jobs (automated check)? We will want them to be green before we proceed. |
|
Hopefully this will do. If not, I'll try again later. |
|
FWIW I suspect CircleCI is hogged, we may just need to wait for that to clear up. Other PRs also seem subject to this now |
htuch
left a comment
There was a problem hiding this comment.
LGTM. As long as it is just the request headers, I think it's totally fine to dump. If we start building a more structured response, with other fields like request body etc., I think it's time to add a proper structured format.
|
Trying to close / reopen to get ci unstuck. |
|
If nothing else helps, you can consider closing this PR and creating a new one with the same content. Since we seem to be out of ideas :( Edit - I see now that you tried just that and it didn't seem to help. @oschaaf any ideas how to move this forward? |
|
FWIW I don't seek the fame of authoring this PR. :) |
|
I mirrored this PR into #349, and CI is running fine over there. |
|
So .. all tests are now passing here |
|
Oh, nice, thanks for your help! |
|
I think the last step is that @mum4k needs to explicitly add an approving review before this PR becomes mergeable. Apparently the CI run of my clone PR was able to green-light CI for this one by flagging the last (shared) commit as OK for all jobs. |
If
echo_request_headersoption is set totrue, then request headers dump is appended to the response body.