mamantoha / crest

HTTP and REST client for Crystal
https://mamantoha.github.io/crest/
MIT License
235 stars 14 forks source link

Support raw string query params #162

Closed cyangle closed 2 years ago

cyangle commented 2 years ago

Support raw string query params, so that query parameter encoding could be handled by user.

This is to make it easy to support various parameter encoding rules specified by the OpenAPI specification here.

For example, Crest::ParamsEncoder.encode({"a" => ["one", "two", "three"]}) gives a[]=one&a[]=two&a[]=three. But according to the spec, it should be a=one&a=two&a=three

Twilio is one of the vendors that require array query params NOT to have square brackets.

Alternatively, this could be supported by an option flag in the Crest::ParamsEncoder that controls whether to add the square brackets or not.

mamantoha commented 2 years ago

Hi @cyangle . Thanks!