appcues / mojito

An easy-to-use Elixir HTTP client, built on the low-level Mint library.
https://hexdocs.pm/mojito/Mojito.html
MIT License
349 stars 34 forks source link

Updates docs for Mojito.post with a json payload #34

Closed marcdel closed 5 years ago

marcdel commented 5 years ago

The docs for Mojito.post pass the result of Jason.encode/1 in the body. This results in an error: {:error, %Mojito.Error{message: "body must be a UTF-8 string", reason: nil}} because Jason.encode/1 returns {:ok, String.t()} | {:error, EncodeError.t() | Exception.t()}.

I think the docs should either use Jason.encode!/1, or call Jason.encode/1 and grab the body out of the tuple in the line above.

gamache commented 5 years ago

Good catch! Thanks for the patch.