This repository was archived by the owner on Mar 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ defmodule PlugRequireHeader do
4343
4444 defp halt_connection ( conn ) do
4545 conn
46- |> put_status ( Status . code :forbidden )
46+ |> send_resp ( Status . code ( :forbidden ) , "" )
4747 |> halt
4848 end
4949end
Original file line number Diff line number Diff line change @@ -10,20 +10,23 @@ defmodule PlugRequireHeaderTest do
1010 response = TestApp . call ( connection , @ options )
1111
1212 assert response . status == Status . code ( :forbidden )
13+ assert response . resp_body == ""
1314 end
1415
1516 test "block request with a header set, but without the required header" do
1617 connection = conn ( :get , "/" ) |> put_req_header ( "x-wrong-header" , "whatever" )
1718 response = TestApp . call ( connection , @ options )
1819
1920 assert response . status == Status . code ( :forbidden )
21+ assert response . resp_body == ""
2022 end
2123
2224 test "block request with the required header set to nil" do
2325 connection = conn ( :get , "/" ) |> put_nil_header ( "x-api-key" )
2426 response = TestApp . call ( connection , @ options )
2527
2628 assert response . status == Status . code ( :forbidden )
29+ assert response . resp_body == ""
2730 end
2831
2932 test "extract the required header and assign it to the connection" do
You can’t perform that action at this time.
0 commit comments