@@ -142,6 +142,16 @@ defmodule HTTPoisonBaseTest do
142
142
assert HTTPoison . get ( "http://localhost" ) == { :error , % HTTPoison.Error { reason: reason } }
143
143
end
144
144
145
+ test "stack trace preserved on error" do
146
+ expect ( :hackney , :request , fn _ , _ , _ , _ , _ -> { :error , { :error , "whatevs" } } end )
147
+
148
+ HTTPoison . get! ( "http://localhost" )
149
+ rescue
150
+ _e ->
151
+ [ { HTTPoison , :request! , 5 , file_line } | _ ] = __STACKTRACE__
152
+ assert { :ok , ~c" lib/httpoison/base.ex" } = Keyword . fetch ( file_line , :file )
153
+ end
154
+
145
155
test "passing connect_timeout option" do
146
156
expect ( :hackney , :request , fn
147
157
:post , "http://localhost" , [ ] , "body" , [ connect_timeout: 12345 ] ->
@@ -221,7 +231,7 @@ defmodule HTTPoisonBaseTest do
221
231
[
222
232
socks5_pass: "secret" ,
223
233
socks5_user: "user" ,
224
- proxy: { :socks5 , ' localhost' , 1080 }
234
+ proxy: { :socks5 , ~c " localhost" , 1080 }
225
235
] ->
226
236
{ :ok , 200 , "headers" , :client }
227
237
end )
@@ -232,7 +242,7 @@ defmodule HTTPoisonBaseTest do
232
242
"localhost" ,
233
243
"body" ,
234
244
[ ] ,
235
- proxy: { :socks5 , ' localhost' , 1080 } ,
245
+ proxy: { :socks5 , ~c " localhost" , 1080 } ,
236
246
socks5_user: "user" ,
237
247
socks5_pass: "secret"
238
248
) ==
@@ -246,7 +256,7 @@ defmodule HTTPoisonBaseTest do
246
256
headers: [ ] ,
247
257
method: :post ,
248
258
options: [
249
- proxy: { :socks5 , ' localhost' , 1080 } ,
259
+ proxy: { :socks5 , ~c " localhost" , 1080 } ,
250
260
socks5_user: "user" ,
251
261
socks5_pass: "secret"
252
262
] ,
0 commit comments