@@ -113,7 +113,6 @@ defmodule Plug.RewriteOnTest do
113
113
assert conn . remote_ip == { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 }
114
114
end
115
115
116
-
117
116
test "rewrites remote_ip with a custom header" do
118
117
conn =
119
118
conn ( :get , "http://example.com/" )
@@ -144,7 +143,6 @@ defmodule Plug.RewriteOnTest do
144
143
assert conn . remote_ip == { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 }
145
144
end
146
145
147
-
148
146
test "rewrites the host, the port, and the protocol" do
149
147
conn =
150
148
conn ( :get , "http://example.com/" )
@@ -158,16 +156,17 @@ defmodule Plug.RewriteOnTest do
158
156
assert conn . scheme == :https
159
157
end
160
158
161
-
162
159
test "rewrites the host, the port, and the protocol with custom headers" do
163
160
conn =
164
161
conn ( :get , "http://example.com/" )
165
162
|> put_req_header ( "custom-forwarded-host" , "truessl.example.com" )
166
163
|> put_req_header ( "custom-forwarded-port" , "3030" )
167
164
|> put_req_header ( "custom-forwarded-proto" , "https" )
168
- |> call ( [ host: "custom-forwarded-host" ,
169
- port: "custom-forwarded-port" ,
170
- scheme: "custom-forwarded-proto" ] )
165
+ |> call (
166
+ host: "custom-forwarded-host" ,
167
+ port: "custom-forwarded-port" ,
168
+ scheme: "custom-forwarded-proto"
169
+ )
171
170
172
171
assert conn . host == "truessl.example.com"
173
172
assert conn . port == 3030
@@ -178,8 +177,9 @@ defmodule Plug.RewriteOnTest do
178
177
assert_raise RuntimeError , "unknown rewrite: :x_forwarded_other" , fn ->
179
178
call ( conn ( :get , "http://example.com/" ) , :x_forwarded_other )
180
179
end
180
+
181
181
assert_raise RuntimeError , "unknown rewrite: {:other, \" value\" }" , fn ->
182
- call ( conn ( :get , "http://example.com/" ) , [ other: "value" ] )
182
+ call ( conn ( :get , "http://example.com/" ) , other: "value" )
183
183
end
184
184
end
185
185
end
0 commit comments