Skip to content

Commit ba2a35c

Browse files
committed
Test HTTPError when redirect is missing a Location header
1 parent 68bd47a commit ba2a35c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

spec/upcheck/http_client_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@
9898
expect(result).to eq("ok" => true)
9999
end
100100

101+
it "raises Upcheck::HTTPError when a redirect is missing a Location header" do
102+
stub_request(:get, url).to_return(status: 302, headers: {})
103+
104+
expect {
105+
described_class.new.get_json(url)
106+
}.to raise_error(Upcheck::HTTPError, /missing Location header/i)
107+
end
108+
101109
it "raises Upcheck::HTTPError after too many redirects" do
102110
stub_request(:get, url).to_return(
103111
status: 301,

0 commit comments

Comments
 (0)