envoy icon indicating copy to clipboard operation
envoy copied to clipboard

Add GetAllHeaders method to golang HTTP filter

Open willemveerman opened this issue 1 year ago • 8 comments

Commit Message: Add GetAllHeaders method to golang HTTP filter Additional Description: Adds a new method which returns a copy of the underlying map[string][]string object which contains all the request headers. Risk Level: Low Testing: Unit test Docs Changes: none required - doesn't change the configuration params of the plugin Release Notes: Platform Specific Features: [Optional Runtime guard:] [Optional Fixes #Issue] [Optional Fixes commit #PR or SHA] [Optional Deprecated:] [Optional API Considerations:]

willemveerman avatar Apr 26 '24 14:04 willemveerman

Hi @willemveerman, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/33821 was opened by willemveerman.

see: more, trace.

As a reminder, PRs marked as draft will not be automatically assigned reviewers, or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

:cat:

Caused by: https://github.com/envoyproxy/envoy/pull/33821 was opened by willemveerman.

see: more, trace.

@doujiang24 i think this may be waiting for further review

phlax avatar May 10 '24 08:05 phlax

@doujiang24 i think this may be waiting for further review

I still need to add the tests

willemveerman avatar May 10 '24 09:05 willemveerman

@doujiang24 I've added what I think is a test, but I'm not sure how to run the tests - can you shed some light?

willemveerman avatar May 14 '24 03:05 willemveerman

@willemveerman Here is a doc section: Testing Envoy with Bazel

For the current ci failure:

compilepkg: missing strict dependencies:
	/b/f/w/contrib/golang/filters/http/test/test_data/basic/filter.go: import of "golang.org/x/exp/slices"

https://dev.azure.com/cncf/envoy/_build/results?buildId=170352&view=logs&j=8c169225-0ae8-53bd-947f-07cb81846cb5&t=d1a98671-b7ba-5fbf-f06c-ff337c010df4&l=159

As the error message shows it missing dependency. it would be a easier way to remove such dependency, it might be a bit complicated to introduce a golang dependency in bazel.

doujiang24 avatar May 14 '24 04:05 doujiang24

~@doujiang24 OK, it's ready for review now~

Actually, I'm just going to improve the tests a little

willemveerman avatar May 14 '24 09:05 willemveerman

OK I've added one further test to cover the case of the headerMap being changed, in order to verify that the slices are being copied. Sorry for delay, I had a hard time building the tests on my m2 arm, but found a workaround. @doujiang24

willemveerman avatar May 15 '24 12:05 willemveerman