@@ -106,27 +106,32 @@ defmodule HTTPoisonBaseTest do
106
106
end
107
107
108
108
test "request body using params example" do
109
- expect ( :hackney , :request , fn :get , "http://localhost?foo=bar&key=fizz" , [ ] , "" , [ ] ->
109
+ expected_query = % { "foo" => "bar" , "key" => "fizz" }
110
+
111
+ expect ( :hackney , :request , fn :get , "http://localhost?" <> query , [ ] , "" , [ ] ->
112
+ assert expected_query == URI . decode_query ( query )
110
113
{ :ok , 200 , "headers" , :client }
111
114
end )
112
115
113
116
expect ( :hackney , :body , fn _ , _ -> { :ok , "response" } end )
114
117
115
- assert ExampleParamsOptions . get! ( "localhost" , [ ] , params: % { foo: "bar" } ) ==
116
- % HTTPoison.Response {
117
- status_code: 200 ,
118
- headers: "headers" ,
119
- body: "response" ,
120
- request_url: "http://localhost?foo=bar&key=fizz" ,
121
- request: % HTTPoison.Request {
122
- body: "" ,
123
- headers: [ ] ,
124
- method: :get ,
125
- options: [ params: % { foo: "bar" , key: "fizz" } ] ,
126
- params: % { foo: "bar" , key: "fizz" } ,
127
- url: "http://localhost?foo=bar&key=fizz"
128
- }
118
+ assert % HTTPoison.Response {
119
+ status_code: 200 ,
120
+ headers: "headers" ,
121
+ body: "response" ,
122
+ request_url: "http://localhost?" <> request_url_query ,
123
+ request: % HTTPoison.Request {
124
+ body: "" ,
125
+ headers: [ ] ,
126
+ method: :get ,
127
+ options: [ params: % { foo: "bar" , key: "fizz" } ] ,
128
+ params: % { foo: "bar" , key: "fizz" } ,
129
+ url: "http://localhost?" <> url_query
129
130
}
131
+ } = ExampleParamsOptions . get! ( "localhost" , [ ] , params: % { foo: "bar" } )
132
+
133
+ assert expected_query == URI . decode_query ( request_url_query )
134
+ assert expected_query == URI . decode_query ( url_query )
130
135
end
131
136
132
137
test "get!/1 raises error tuple" do
0 commit comments