kong icon indicating copy to clipboard operation
kong copied to clipboard

fix(admin-api): nested parameters can be parsed correctly when using form-urlencoded requests

Open ms2008 opened this issue 1 year ago • 0 comments

Summary

When using curl to send a form-urlencoded request with nested parameters, such as

$ curl -X POST http://localhost:8001/parsed_params \
   --data 'items[1]=foo' \
   --data 'items[2]=bar'

the expected response is {"items":["foo","bar"]}, but instead, it returns {"items":{}}.

This is actually an EE issue, but I see that there is a risk of this in CE even though it doesn't currently occur. So I initiated that fix on CE.

The cause of the problem is due to the fact that nested parameters are lost when the decode_args method is called twice, without this fix.

Checklist

  • [x] The Pull Request has tests
  • [x] A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • [ ] There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix FTI-6165

ms2008 avatar Sep 14 '24 03:09 ms2008