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.
The docs for
Mojito.post
pass the result ofJason.encode/1
in the body. This results in an error:{:error, %Mojito.Error{message: "body must be a UTF-8 string", reason: nil}}
becauseJason.encode/1
returns{:ok, String.t()} | {:error, EncodeError.t() | Exception.t()}
.I think the docs should either use
Jason.encode!/1
, or callJason.encode/1
and grab the body out of the tuple in the line above.