consul
consul copied to clipboard
[Old] using WeakDecode for parseHttpHandlerConfig
Fixes #17595
Using WeakDecode instead of Decode while parsing HttpHandlerConfig alone. This ensures slice with single element is decoded to slice instead of just string (if it is required to be a slice as per Config).
@Maintainers @team @jkirschner-hashicorp @huikang Reminding to review this PR
@vijayraghav-io , thanks for the PR. It would be nice if you could add a unit test for the change.
Hi @huikang, Sorry, Somehow i had missed to track this conversation and PR, hence delayed response.
Refer new PR - https://github.com/hashicorp/consul/pull/18473 (created new due to merge issues in old/this PR)
Added the test data - "watches.hcl" as new test data with header element as 1 element slice (issue reported usecase). Added both test cases for same test data -
- using weakdecode
- using decode (assert error - to show using decode (as before) would create error for above test data.
Also updated the approach a little bit ( better design :) )
- By default and first, Decode is used while parsing httpHandlerConfig (as before), Only if error occurs then WeakDecode is used in 2nd attempt. This ensures we are not using WeakDecode blindly in all cases.
This PR can be discarded and refer to https://github.com/hashicorp/consul/pull/18473 , for review and discussion
This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.
This PR is a reference for a new PR - https://github.com/hashicorp/consul/pull/18473, @huikang
This pull request has been automatically flagged for inactivity because it has not been acted upon in the last 60 days. It will be closed if no new activity occurs in the next 30 days. Please feel free to re-open to resurrect the change if you feel this has happened by mistake. Thank you for your contributions.
Closing due to inactivity. If you feel this was a mistake or you wish to re-open at any time in the future, please leave a comment and it will be re-surfaced for the maintainers to review.