rack-pjax 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +15 -6
- data/Appraisals +8 -0
- data/Gemfile +2 -0
- data/gemfiles/rack_1.gemfile +9 -0
- data/gemfiles/rack_2.gemfile +8 -0
- data/lib/rack/pjax.rb +2 -2
- data/lib/rack/pjax/version.rb +1 -1
- data/rack-pjax.gemspec +1 -0
- data/spec/rack/pjax_spec.rb +11 -3
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7afc6b61d7b2cc2a2351b2c8336f288823e3e90bd04310d6e2d8cb60b5c9a402
|
4
|
+
data.tar.gz: a74afe97e7d52b755efadf5bd5b717788c8f9bd585acbd044d2524e7f71d0917
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7fcd43cf4affe6bcb3dce1872e968ac5a145159d36646bbb99b834876b1d399dd7b1a63fdbbd1913f2c946c4f784c94f5e8f7abb29e5fce0eeb0fd137cdfdd
|
7
|
+
data.tar.gz: 0bfd6b4346e0390ddd1dee8ae6564bff8d2b4fcb156ae24f898da31d7c82807501162498ab104a74bf038347c6eda85dd96ee2ece778dabbc7c08e056bc00c0d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
rvm:
|
2
2
|
- 1.9.3
|
3
|
-
- 2.1.
|
4
|
-
- 2.2.
|
5
|
-
- 2.3.
|
3
|
+
- 2.1.10
|
4
|
+
- 2.2.7
|
5
|
+
- 2.3.4
|
6
|
+
- 2.4.1
|
6
7
|
- jruby
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/rack_1.gemfile
|
10
|
+
- gemfiles/rack_2.gemfile
|
11
|
+
matrix:
|
12
|
+
exclude:
|
13
|
+
- rvm: 1.9.3
|
14
|
+
gemfile: gemfiles/rack_2.gemfile
|
15
|
+
- rvm: 2.1.10
|
16
|
+
gemfile: gemfiles/rack_2.gemfile
|
17
|
+
- rvm: jruby
|
18
|
+
gemfile: gemfiles/rack_2.gemfile
|
10
19
|
cache: bundler
|
11
20
|
sudo: false
|
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/lib/rack/pjax.rb
CHANGED
@@ -16,7 +16,7 @@ module Rack
|
|
16
16
|
|
17
17
|
new_body = ""
|
18
18
|
body.each do |b|
|
19
|
-
b.force_encoding('UTF-8') if RUBY_VERSION > '1.9.0'
|
19
|
+
b = b.dup.force_encoding('UTF-8') if RUBY_VERSION > '1.9.0'
|
20
20
|
|
21
21
|
parsed_body = Nokogiri::HTML(b)
|
22
22
|
container = parsed_body.at(container_selector(env))
|
@@ -34,7 +34,7 @@ module Rack
|
|
34
34
|
|
35
35
|
body.close if body.respond_to?(:close)
|
36
36
|
|
37
|
-
headers['Content-Length'] &&=
|
37
|
+
headers['Content-Length'] &&= new_body.bytesize.to_s
|
38
38
|
headers['X-PJAX-URL'] ||= Rack::Request.new(env).fullpath
|
39
39
|
|
40
40
|
[status, headers, [new_body]]
|
data/lib/rack/pjax/version.rb
CHANGED
data/rack-pjax.gemspec
CHANGED
@@ -8,6 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Gert Goet"]
|
9
9
|
s.email = ["gert@thinkcreate.nl"]
|
10
10
|
s.homepage = "https://github.com/eval/rack-pjax"
|
11
|
+
s.license = "MIT"
|
11
12
|
s.summary = %q{Serve pjax responses through rack middleware}
|
12
13
|
s.description = %q{Serve pjax responses through rack middleware}
|
13
14
|
|
data/spec/rack/pjax_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe Rack::Pjax do
|
|
11
11
|
lambda do |env|
|
12
12
|
[
|
13
13
|
200,
|
14
|
-
{'Content-Type' => 'text/plain', 'Content-Length' =>
|
14
|
+
{'Content-Type' => 'text/plain', 'Content-Length' => body.bytesize.to_s},
|
15
15
|
[body]
|
16
16
|
]
|
17
17
|
end
|
@@ -67,9 +67,17 @@ describe Rack::Pjax do
|
|
67
67
|
expect(body).to eq('<p>foo<br>bar</p>')
|
68
68
|
end
|
69
69
|
|
70
|
+
it "should handle frozen body string correctly" do
|
71
|
+
self.class.app = generate_app(:body => '<html><body><div data-pjax-container><p>foo<br>bar</p></div></body></html>'.freeze)
|
72
|
+
|
73
|
+
get "/", {}, {"HTTP_X_PJAX" => "true"}
|
74
|
+
|
75
|
+
expect(body).to eq('<p>foo<br>bar</p>')
|
76
|
+
end
|
77
|
+
|
70
78
|
it "should return the correct Content Length" do
|
71
79
|
get "/", {}, {"HTTP_X_PJAX" => "true"}
|
72
|
-
expect(headers['Content-Length']).to eq(
|
80
|
+
expect(headers['Content-Length']).to eq(body.bytesize.to_s)
|
73
81
|
end
|
74
82
|
|
75
83
|
it "should return the original body when there's no pjax-container" do
|
@@ -104,7 +112,7 @@ BODY
|
|
104
112
|
|
105
113
|
it "should return the correct Content Length" do
|
106
114
|
get "/"
|
107
|
-
expect(headers['Content-Length']).to eq(
|
115
|
+
expect(headers['Content-Length']).to eq(body.bytesize.to_s)
|
108
116
|
end
|
109
117
|
end
|
110
118
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-pjax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gert Goet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -89,10 +89,13 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- ".gitignore"
|
91
91
|
- ".travis.yml"
|
92
|
+
- Appraisals
|
92
93
|
- Gemfile
|
93
94
|
- LICENSE
|
94
95
|
- README.md
|
95
96
|
- Rakefile
|
97
|
+
- gemfiles/rack_1.gemfile
|
98
|
+
- gemfiles/rack_2.gemfile
|
96
99
|
- lib/rack-pjax.rb
|
97
100
|
- lib/rack/pjax.rb
|
98
101
|
- lib/rack/pjax/version.rb
|
@@ -101,7 +104,8 @@ files:
|
|
101
104
|
- spec/spec.opts
|
102
105
|
- spec/spec_helper.rb
|
103
106
|
homepage: https://github.com/eval/rack-pjax
|
104
|
-
licenses:
|
107
|
+
licenses:
|
108
|
+
- MIT
|
105
109
|
metadata: {}
|
106
110
|
post_install_message:
|
107
111
|
rdoc_options: []
|
@@ -118,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
122
|
- !ruby/object:Gem::Version
|
119
123
|
version: '0'
|
120
124
|
requirements: []
|
121
|
-
|
122
|
-
rubygems_version: 2.2.2
|
125
|
+
rubygems_version: 3.0.3
|
123
126
|
signing_key:
|
124
127
|
specification_version: 4
|
125
128
|
summary: Serve pjax responses through rack middleware
|