-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requests hang forever when using integers as values in multipart #230
Comments
I can't test this right now, please try to produce the failing minimal example against requestbin or similar service. |
Using string:mp =
Multipart.new()
|> Multipart.add_field("foo", "123")
Tesla.post("http://requestbin.net/r/1mw0e3c1", mp) Output: {:ok,
%Tesla.Env{
__client__: %Tesla.Client{fun: nil, post: [], pre: []},
__module__: Tesla,
body: "ip:177.124.185.70\n",
headers: [
{"connection", "keep-alive"},
{"date", "Wed, 18 Jul 2018 20:22:07 GMT"},
{"via", "1.1 vegur"},
{"server", "cloudflare"},
{"content-length", "18"},
{"content-type", "text/html; charset=utf-8"},
{"set-cookie",
"__cfduid=d0511378e77d3b91c1043de753a3482371531945327; expires=Thu, 18-Jul-19 20:22:07 GMT; path=/; domain=.requestbin.net; HttpOnly"},
{"sponsored-by", "http://requestbin.net"},
{"cf-ray", "43c7a897729ab8b9-MIA"}
],
method: :post,
opts: [],
query: [],
status: 200,
url: "http://requestbin.net/r/1mw0e3c1"
}} Using integer:mp =
Multipart.new()
|> Multipart.add_field("foo", 123)
Tesla.post("http://requestbin.net/r/1mw0e3c1", mp) Never outputs. |
The hanging part is because of The error is much more clear when used with
I think we need to add a guard to |
Environment
uname -a
output:elixir --version
output:Current behavior
When passing a integer value as third argument to
add_field/4
, it never returns when executing the request:This works fine:
Expected behavior
I would expect it to either work fine with integers or to throw an error when I try to pass something that is not a string, whichever makes more sense.
The text was updated successfully, but these errors were encountered: