Closed richardboehme closed 3 years ago
Hi.
The latest release (v0.27.1) does not speak JSON natively, so convert your hash to a string with .to_json
method before passing it to crest
.
Crest.post(
"http://httpbin.org/post",
form: {"foo" => "bar"}.to_json
headers: {"Accept" => "application/json"},
)
The future version will do the same with:
Crest.post("http://httpbin.org/post", {"foo" => "bar"}, json: true)
You can use the latest version from this repository by changing your shards.yml
dependencies:
crest:
github: mamantoha/crest
branch: master
Ah this is great, thank you! I was looking at the README of the master branch... Sorry!
Hey! 👋 Thanks for this great shard! I'm currently using it to consume an API that requires a JSON schema, that contains arrays and numbers. If I understand correctly one can use params that are converted to JSON automatically. However params have the type Hash(String, String) so we cannot use different types for values.
According to the documentation there is the possibility to pass a raw string as a second argument to
Crest.post
. However, this throws a compiler error for me:Was this behavior changed recently and is there an alternative to use?