prerender_rails 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prerender_rails.rb +2 -2
- data/prerender_rails.gemspec +1 -1
- data/test/lib/prerender_rails.rb +13 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88327c1eef50841086d43deca57df0e495ef5ea6
|
4
|
+
data.tar.gz: 49e7c5e8873b8f098cd3d0e2d39cc5b7c9b06c02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 760b14cad2978e94f26d0c8efac6a9a98f86c5a34dc1e21e1dc7aac6d1ca32080570c8da02179753b5acdca02109260132836a1cded81f98c024389b221ca44e
|
7
|
+
data.tar.gz: 3b4dccb2d2d3fbeef2d1772b851337f4f36eba2642bde628833091428a3989190e02e1ce671b2100c5b78be8721db1ad70f4bd8c3b18b11b5fac5781b6505fdc
|
data/lib/prerender_rails.rb
CHANGED
@@ -114,8 +114,8 @@ module Rack
|
|
114
114
|
|
115
115
|
def should_show_prerendered_page(env)
|
116
116
|
user_agent = env['HTTP_USER_AGENT']
|
117
|
-
buffer_agent = env['
|
118
|
-
prerender_agent = env['
|
117
|
+
buffer_agent = env['HTTP_X_BUFFERBOT']
|
118
|
+
prerender_agent = env['HTTP_X_PRERENDER']
|
119
119
|
is_requesting_prerendered_page = false
|
120
120
|
|
121
121
|
return false if !user_agent
|
data/prerender_rails.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "prerender_rails"
|
5
|
-
spec.version = "1.5.
|
5
|
+
spec.version = "1.5.1"
|
6
6
|
spec.authors = ["Todd Hooper"]
|
7
7
|
spec.email = ["todd@prerender.io"]
|
8
8
|
spec.description = %q{Rails middleware to prerender your javascript heavy pages on the fly by a phantomjs service}
|
data/test/lib/prerender_rails.rb
CHANGED
@@ -58,6 +58,14 @@ describe Rack::Prerender do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
|
61
|
+
it "should continue to app routes if contains X-Prerender header" do
|
62
|
+
request = Rack::MockRequest.env_for "/path?_escaped_fragment_=", "HTTP_USER_AGENT" => user, "HTTP_X_PRERENDER" => "1"
|
63
|
+
response = Rack::Prerender.new(@app).call(request)
|
64
|
+
|
65
|
+
assert_equal "", response[2]
|
66
|
+
end
|
67
|
+
|
68
|
+
|
61
69
|
it "should continue to app routes if user is a bot, but the bot is requesting a resource file" do
|
62
70
|
request = Rack::MockRequest.env_for "/main.js?anyQueryParam=true", "HTTP_USER_AGENT" => bot
|
63
71
|
response = Rack::Prerender.new(@app).call(request)
|
@@ -75,13 +83,13 @@ describe Rack::Prerender do
|
|
75
83
|
|
76
84
|
|
77
85
|
it "should set use_ssl to true for https prerender_service_url" do
|
78
|
-
|
86
|
+
@prerender = Rack::Prerender.new(@app, prerender_service_url: 'https://service.prerender.io/')
|
79
87
|
|
80
|
-
|
81
|
-
|
82
|
-
|
88
|
+
request = Rack::MockRequest.env_for "/search/things/123/page?_escaped_fragment_=", "HTTP_USER_AGENT" => bot
|
89
|
+
stub_request(:get, @prerender.build_api_url(request)).to_return(:body => "<html></html>")
|
90
|
+
response = @prerender.call(request)
|
83
91
|
|
84
|
-
|
92
|
+
assert_equal ["<html></html>"], response[2].body
|
85
93
|
end
|
86
94
|
|
87
95
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prerender_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Hooper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|