@@ -32,11 +32,13 @@ defmodule HTTPoisonBaseTest do
3232 expect ( :hackney , :request , [ { [ :post , "http://localhost" , { :req_headers , [ ] } , { :req_body , "body" } , [ ] ] ,
3333 { :ok , 200 , "headers" , :client } } ] )
3434 expect ( :hackney , :body , 1 , { :ok , "response" } )
35+ expect ( :hackney , :location , 1 , "location" )
3536
3637 assert Example . post! ( "localhost" , "body" ) ==
3738 % HTTPoison.Response { status_code: { :code , 200 } ,
3839 headers: { :headers , "headers" } ,
39- body: { :resp_body , "response" } }
40+ body: { :resp_body , "response" } ,
41+ location: "location" }
4042
4143 assert validate :hackney
4244 end
@@ -45,11 +47,13 @@ defmodule HTTPoisonBaseTest do
4547 expect ( :hackney , :request , [ { [ :post , "http://localhost" , { :req_headers , [ ] } , { :req_body , "body" } , [ ] ] ,
4648 { :ok , 200 , "headers" , :client } } ] )
4749 expect ( :hackney , :body , 1 , { :ok , "response" } )
50+ expect ( :hackney , :location , 1 , "location" )
4851
4952 assert ExampleDefp . post! ( "localhost" , "body" ) ==
5053 % HTTPoison.Response { status_code: { :code , 200 } ,
5154 headers: { :headers , "headers" } ,
52- body: { :resp_body , "response" } }
55+ body: { :resp_body , "response" } ,
56+ location: "location" }
5357
5458 assert validate :hackney
5559 end
@@ -71,11 +75,13 @@ defmodule HTTPoisonBaseTest do
7175 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ connect_timeout: 12345 ] ] ,
7276 { :ok , 200 , "headers" , :client } } ] )
7377 expect ( :hackney , :body , 1 , { :ok , "response" } )
78+ expect ( :hackney , :location , 1 , "location" )
7479
7580 assert HTTPoison . post! ( "localhost" , "body" , [ ] , timeout: 12345 ) ==
7681 % HTTPoison.Response { status_code: 200 ,
7782 headers: "headers" ,
78- body: "response" }
83+ body: "response" ,
84+ location: "location" }
7985
8086 assert validate :hackney
8187 end
@@ -84,11 +90,13 @@ defmodule HTTPoisonBaseTest do
8490 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ recv_timeout: 12345 ] ] ,
8591 { :ok , 200 , "headers" , :client } } ] )
8692 expect ( :hackney , :body , 1 , { :ok , "response" } )
93+ expect ( :hackney , :location , 1 , "location" )
8794
8895 assert HTTPoison . post! ( "localhost" , "body" , [ ] , recv_timeout: 12345 ) ==
8996 % HTTPoison.Response { status_code: 200 ,
9097 headers: "headers" ,
91- body: "response" }
98+ body: "response" ,
99+ location: "location" }
92100
93101 assert validate :hackney
94102 end
@@ -97,11 +105,13 @@ defmodule HTTPoisonBaseTest do
97105 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ proxy: "proxy" ] ] ,
98106 { :ok , 200 , "headers" , :client } } ] )
99107 expect ( :hackney , :body , 1 , { :ok , "response" } )
108+ expect ( :hackney , :location , 1 , "location" )
100109
101110 assert HTTPoison . post! ( "localhost" , "body" , [ ] , proxy: "proxy" ) ==
102111 % HTTPoison.Response { status_code: 200 ,
103112 headers: "headers" ,
104- body: "response" }
113+ body: "response" ,
114+ location: "location" }
105115
106116 assert validate :hackney
107117 end
@@ -110,11 +120,13 @@ defmodule HTTPoisonBaseTest do
110120 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ proxy_auth: { "username" , "password" } , proxy: "proxy" ] ] ,
111121 { :ok , 200 , "headers" , :client } } ] )
112122 expect ( :hackney , :body , 1 , { :ok , "response" } )
123+ expect ( :hackney , :location , 1 , "location" )
113124
114125 assert HTTPoison . post! ( "localhost" , "body" , [ ] , [ proxy: "proxy" , proxy_auth: { "username" , "password" } ] ) ==
115126 % HTTPoison.Response { status_code: 200 ,
116127 headers: "headers" ,
117- body: "response" }
128+ body: "response" ,
129+ location: "location" }
118130
119131 assert validate :hackney
120132 end
@@ -123,11 +135,13 @@ defmodule HTTPoisonBaseTest do
123135 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ ssl_options: [ certfile: "certs/client.crt" ] ] ] ,
124136 { :ok , 200 , "headers" , :client } } ] )
125137 expect ( :hackney , :body , 1 , { :ok , "response" } )
138+ expect ( :hackney , :location , 1 , "location" )
126139
127140 assert HTTPoison . post! ( "localhost" , "body" , [ ] , ssl: [ certfile: "certs/client.crt" ] ) ==
128141 % HTTPoison.Response { status_code: 200 ,
129142 headers: "headers" ,
130- body: "response" }
143+ body: "response" ,
144+ location: "location" }
131145
132146 assert validate :hackney
133147 end
@@ -136,11 +150,13 @@ defmodule HTTPoisonBaseTest do
136150 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ follow_redirect: true ] ] ,
137151 { :ok , 200 , "headers" , :client } } ] )
138152 expect ( :hackney , :body , 1 , { :ok , "response" } )
153+ expect ( :hackney , :location , 1 , "location" )
139154
140155 assert HTTPoison . post! ( "localhost" , "body" , [ ] , follow_redirect: true ) ==
141156 % HTTPoison.Response { status_code: 200 ,
142157 headers: "headers" ,
143- body: "response" }
158+ body: "response" ,
159+ location: "location" }
144160
145161 assert validate :hackney
146162 end
@@ -149,11 +165,13 @@ defmodule HTTPoisonBaseTest do
149165 expect ( :hackney , :request , [ { [ :post , "http://localhost" , [ ] , "body" , [ max_redirect: 2 ] ] ,
150166 { :ok , 200 , "headers" , :client } } ] )
151167 expect ( :hackney , :body , 1 , { :ok , "response" } )
168+ expect ( :hackney , :location , 1 , "location" )
152169
153170 assert HTTPoison . post! ( "localhost" , "body" , [ ] , max_redirect: 2 ) ==
154171 % HTTPoison.Response { status_code: 200 ,
155172 headers: "headers" ,
156- body: "response" }
173+ body: "response" ,
174+ location: "location" }
157175
158176 assert validate :hackney
159177 end
0 commit comments