mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 20:24:47 +08:00
FIX: follow redirects for inline/mini onebox (#13512)
This commit is contained in:
@ -89,5 +89,16 @@ describe RetrieveTitle do
|
||||
IPSocket.stubs(:getaddress).returns('100.2.3.4')
|
||||
expect(RetrieveTitle.crawl("https://brelksdjflaskfj.com/amazing")).to eq("japanese こんにちは website")
|
||||
end
|
||||
|
||||
it "can follow redirect" do
|
||||
stub_request(:get, "http://foobar.com/amazing").
|
||||
to_return(status: 301, body: "", headers: { "location" => "https://wikipedia.com/amazing" })
|
||||
|
||||
stub_request(:get, "https://wikipedia.com/amazing").
|
||||
to_return(status: 200, body: "<html><title>very amazing</title>", headers: {})
|
||||
|
||||
IPSocket.stubs(:getaddress).returns('100.2.3.4')
|
||||
expect(RetrieveTitle.crawl("http://foobar.com/amazing")).to eq("very amazing")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user