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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db685df40cb56db49ec9ec692fe48ac300fcab08
4
- data.tar.gz: b4602eb9e00e3cbf97ea8aed467211695765b158
3
+ metadata.gz: 88327c1eef50841086d43deca57df0e495ef5ea6
4
+ data.tar.gz: 49e7c5e8873b8f098cd3d0e2d39cc5b7c9b06c02
5
5
  SHA512:
6
- metadata.gz: 57f92a2d64f32826258d5687734568629d00b6d8e9c58a4db132278b83dcf740244d440566ff9e6f46bb3f05dabab57ef05a165e0d64666ecf109a22c86592df
7
- data.tar.gz: aea4c87bac266fe036da034d9ab7dc051b41685f02e18c4d20b543b379c182cfd8209220627d95dad6deb279eca621a2c568a789eb5d541c90c0e900c4768c94
6
+ metadata.gz: 760b14cad2978e94f26d0c8efac6a9a98f86c5a34dc1e21e1dc7aac6d1ca32080570c8da02179753b5acdca02109260132836a1cded81f98c024389b221ca44e
7
+ data.tar.gz: 3b4dccb2d2d3fbeef2d1772b851337f4f36eba2642bde628833091428a3989190e02e1ce671b2100c5b78be8721db1ad70f4bd8c3b18b11b5fac5781b6505fdc
@@ -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['X-BUFFERBOT']
118
- prerender_agent = env['X-PRERENDER']
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "prerender_rails"
5
- spec.version = "1.5.0"
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}
@@ -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
- @prerender = Rack::Prerender.new(@app, prerender_service_url: 'https://service.prerender.io/')
86
+ @prerender = Rack::Prerender.new(@app, prerender_service_url: 'https://service.prerender.io/')
79
87
 
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)
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
- assert_equal ["<html></html>"], response[2].body
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.0
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-23 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack