Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/test/tesla/adapter/hackney_test.exs b/test/tesla/adapter/hackney_test.exs
index b73bc95..6f61611 100644
--- a/test/tesla/adapter/hackney_test.exs
+++ b/test/tesla/adapter/hackney_test.exs
@@ -1,35 +1,52 @@
defmodule Tesla.Adapter.HackneyTest do
use ExUnit.Case
use Tesla.AdapterCase, adapter: Tesla.Adapter.Hackney
use Tesla.AdapterCase.Basic
use Tesla.AdapterCase.Multipart
use Tesla.AdapterCase.StreamRequestBody
use Tesla.AdapterCase.SSL,
ssl_options: [
cacertfile: "#{:code.priv_dir(:httparrot)}/ssl/server-ca.crt"
]
alias Tesla.Env
test "get with `with_body: true` option" do
request = %Env{
method: :get,
url: "#{@http}/ip"
}
assert {:ok, %Env{} = response} = call(request, with_body: true)
assert response.status == 200
end
test "get with `with_body: true` option even when async" do
request = %Env{
method: :get,
url: "#{@http}/ip"
}
assert {:ok, %Env{} = response} = call(request, with_body: true, async: true)
assert response.status == 200
end
+
+ test "stream request body: error" do
+ body =
+ Stream.unfold(5, fn
+ 0 -> nil
+ 3 -> {fn -> {:error, :fake_error} end, 2}
+ n -> {to_string(n), n - 1}
+ end)
+
+ request = %Env{
+ method: :post,
+ url: "#{@http}/post",
+ body: body
+ }
+
+ assert {:error, :fake_error} = call(request)
+ end
end

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 9:50 PM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39968
Default Alt Text
(1 KB)

Event Timeline