File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 7474 end
7575
7676
77+ it "should set use_ssl to true for https prerender_service_url" do
78+ @prerender = Rack ::Prerender . new ( @app , prerender_service_url : 'https://service.prerender.io/' )
79+
80+ request = Rack ::MockRequest . env_for "/search/things/123/page?_escaped_fragment_=" , "HTTP_USER_AGENT" => bot
81+ stub_request ( :get , @prerender . build_api_url ( request ) ) . to_return ( :body => "<html></html>" )
82+ response = @prerender . call ( request )
83+
84+ assert_equal [ "<html></html>" ] , response [ 2 ] . body
85+ end
86+
87+
7788 it "should return a prerendered response if the url is part of the regex specific whitelist" do
7889 request = Rack ::MockRequest . env_for "/search/things/123/page?_escaped_fragment_=" , "HTTP_USER_AGENT" => bot
7990 stub_request ( :get , @prerender . build_api_url ( request ) ) . to_return ( :body => "<html></html>" )
164175 end
165176
166177
178+ it "should build the correct https api url with an initialization variable url" do
179+ @prerender = Rack ::Prerender . new ( @app , prerender_service_url : 'https://prerenderurl.com' )
180+ request = Rack ::MockRequest . env_for "https://google.com/search?q=javascript"
181+ assert_equal 'https://prerenderurl.com/https://google.com/search?q=javascript' , @prerender . build_api_url ( request )
182+ end
183+
184+
167185 # Check CF-Visitor header in order to Work behind CloudFlare with Flexible SSL (https://support.cloudflare.com/hc/en-us/articles/200170536)
168186 it "should build the correct api url for the Cloudflare Flexible SSL support" do
169187 request = Rack ::MockRequest . env_for "http://google.com/search?q=javascript" , { 'CF-VISITOR' => '"scheme":"https"' }
You can’t perform that action at this time.
0 commit comments