Custom params encoders
What's Changed
-
Tested with Crystal 1.3.0
-
Accept
Float32
andFloat64
as params value by @mamantoha in #166 -
Add custom params encoders by @mamantoha in #167
(thanks @cyangle for the idea in #162)It is now possible to use a custom params encoder. For example
Crest::NestedParamsEncoder
:response = Crest.post( "http://httpbin.org/post", {"size" => "small", "topping" => ["bacon", "onion"]}, params_encoder: Crest::NestedParamsEncoder ) # => curl -X POST http://httpbin.org/post -d 'size=small&topping=bacon&topping=onion' -H 'Content-Type: application/x-www-form-urlencoded'
By defaulf
Crest::FlatParamsEncoder
is used:response = Crest.post( "http://httpbin.org/post", {"size" => "small", "topping" => ["bacon", "onion"]} ) # => curl -X POST http://httpbin.org/post -d 'size=small&topping[]=bacon&topping[]=onion' -H 'Content-Type: application/x-www-form-urlencoded'
New Contributors
Full Changelog: v1.0.1...v1.1.0