consul icon indicating copy to clipboard operation
consul copied to clipboard

[Old] using WeakDecode for parseHttpHandlerConfig

Open vijayraghav-io opened this issue 1 year ago • 7 comments

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).

vijayraghav-io avatar Jun 09 '23 08:06 vijayraghav-io

CLA assistant check
All committers have signed the CLA.

hashicorp-cla avatar Jun 09 '23 08:06 hashicorp-cla

@Maintainers @team @jkirschner-hashicorp @huikang Reminding to review this PR

vijayraghav-io avatar Jun 15 '23 11:06 vijayraghav-io

@vijayraghav-io , thanks for the PR. It would be nice if you could add a unit test for the change.

huikang avatar Jun 22 '23 23:06 huikang

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.

vijayraghav-io avatar Aug 15 '23 19:08 vijayraghav-io

This PR can be discarded and refer to https://github.com/hashicorp/consul/pull/18473 , for review and discussion

vijayraghav-io avatar Aug 15 '23 19:08 vijayraghav-io

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.

github-actions[bot] avatar Jan 24 '24 01:01 github-actions[bot]

This PR is a reference for a new PR - https://github.com/hashicorp/consul/pull/18473, @huikang

vijayraghav-io avatar Jan 24 '24 05:01 vijayraghav-io

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.

github-actions[bot] avatar May 31 '24 01:05 github-actions[bot]

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.

github-actions[bot] avatar Jun 30 '24 01:06 github-actions[bot]