rewritten 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY.rdoc +4 -0
- data/lib/rack/url.rb +2 -3
- data/lib/rewritten/version.rb +1 -1
- data/test/rack/rewritten_url_test.rb +16 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7a6bb53aa68bfdf91a14ddb75bc1c84626d4722
|
4
|
+
data.tar.gz: f0b6c9dc59ae890105a08d8e718da649903949f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 943f60c79e3c96113f0fb4cd6556cdbb079c1cd34caa476ca46065c2529096c3661c8a7d1a0cc5bc31d6be293694bffa3da898b5bc4b689eb2e05b7e4a9ac933
|
7
|
+
data.tar.gz: 135a2c929eaaedd54cd8558797885632eb42a22d806732c0dc221f8d984f20f31a870bc20bdadacbd42e023be8645267f7d7f7be51614b0f8d7faaffc21905f3
|
data/HISTORY.rdoc
CHANGED
data/lib/rack/url.rb
CHANGED
@@ -50,8 +50,7 @@ module Rack
|
|
50
50
|
if (current_path == req.path_info) or (::Rewritten.base_from(req.path_info) == current_path) or ::Rewritten.has_flag?(path, 'L')
|
51
51
|
# if this is the current path, rewrite path and parameters
|
52
52
|
tpath, tparams = split_to_path_params(to)
|
53
|
-
|
54
|
-
env['QUERY_STRING'] = Rack::Utils.build_query(tparams.merge(req.params))
|
53
|
+
env['QUERY_STRING'] = Rack::Utils.build_nested_query(tparams.merge(req.params))
|
55
54
|
req.path_info = tpath + ::Rewritten.appendix(req.path_info)
|
56
55
|
@app.call(req.env)
|
57
56
|
else
|
@@ -77,7 +76,7 @@ module Rack
|
|
77
76
|
|
78
77
|
def split_to_path_params(path_and_query)
|
79
78
|
path, query_string = path_and_query.split('?').push('')[0..1]
|
80
|
-
[path, Rack::Utils.parse_query(query_string)]
|
79
|
+
[path, Rack::Utils.parse_query(query_string)]
|
81
80
|
end
|
82
81
|
|
83
82
|
private
|
data/lib/rewritten/version.rb
CHANGED
@@ -12,7 +12,7 @@ describe Rack::Rewritten::Url do
|
|
12
12
|
'rack.input' => '',
|
13
13
|
'rack.url_scheme' => 'http'}.merge(overrides)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def request_url(url, params={})
|
17
17
|
call_args.merge({'REQUEST_URI' => url, 'PATH_INFO' => url}.merge(params) )
|
18
18
|
end
|
@@ -83,12 +83,12 @@ describe Rack::Rewritten::Url do
|
|
83
83
|
|
84
84
|
describe "partial translation" do
|
85
85
|
|
86
|
-
before do
|
86
|
+
before do
|
87
87
|
@request_str = '/foo/baz/with_tail'
|
88
88
|
@env = request_url(@request_str)
|
89
|
-
Rewritten.translate_partial = true
|
90
|
-
end
|
91
|
-
|
89
|
+
Rewritten.translate_partial = true
|
90
|
+
end
|
91
|
+
|
92
92
|
after do
|
93
93
|
Rewritten.translate_partial = false
|
94
94
|
end
|
@@ -104,7 +104,7 @@ describe Rack::Rewritten::Url do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it "must translate partials if enabled" do
|
107
|
-
Rewritten.translate_partial = true
|
107
|
+
Rewritten.translate_partial = true
|
108
108
|
@app.expect :call, [200, {'Content-Type' => 'text/html'},[]], [Hash]
|
109
109
|
ret = @rack.call @env
|
110
110
|
@app.verify
|
@@ -123,7 +123,7 @@ describe Rack::Rewritten::Url do
|
|
123
123
|
@env['PATH_INFO'].must_equal url
|
124
124
|
end
|
125
125
|
|
126
|
-
|
126
|
+
|
127
127
|
it "won't translate segments not by separated by slashes" do
|
128
128
|
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[""]], [Hash]
|
129
129
|
ret = @rack.call @env=request_url('/foo/bazzling')
|
@@ -151,7 +151,7 @@ describe Rack::Rewritten::Url do
|
|
151
151
|
end
|
152
152
|
|
153
153
|
describe "caps behavior" do
|
154
|
-
|
154
|
+
|
155
155
|
it "must diferentiate caps" do
|
156
156
|
@app.expect :call, [200, {'Content-Type' => 'text/plain'},[""]], [Hash]
|
157
157
|
ret = @rack.call request_url('/Foo/Bar')
|
@@ -240,7 +240,7 @@ describe Rack::Rewritten::Url do
|
|
240
240
|
|
241
241
|
it "must set PATH_INFO to /products/2" do
|
242
242
|
@rack.call(@initial_args)
|
243
|
-
@initial_args['PATH_INFO'].must_equal "/products/2"
|
243
|
+
@initial_args['PATH_INFO'].must_equal "/products/2"
|
244
244
|
end
|
245
245
|
|
246
246
|
it "must set QUERY_STRING to w=1" do
|
@@ -254,9 +254,15 @@ describe Rack::Rewritten::Url do
|
|
254
254
|
@initial_args['QUERY_STRING'].split('&').sort.must_equal ['s=1', 'w=1']
|
255
255
|
end
|
256
256
|
|
257
|
+
it "must merge nested rails style QUERY parameters" do
|
258
|
+
@initial_args.merge!('QUERY_STRING' => 'x[id]=1')
|
259
|
+
@rack.call(@initial_args)
|
260
|
+
@initial_args['QUERY_STRING'].split('&').sort.map{|s| URI.unescape(s)}.must_equal ['w=1', 'x[id]=1']
|
261
|
+
end
|
262
|
+
|
263
|
+
|
257
264
|
end
|
258
265
|
|
259
266
|
|
260
267
|
|
261
268
|
end
|
262
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rewritten
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Rubarth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-namespace
|
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
238
|
version: '0'
|
239
239
|
requirements: []
|
240
240
|
rubyforge_project: rewritten
|
241
|
-
rubygems_version: 2.
|
241
|
+
rubygems_version: 2.4.6
|
242
242
|
signing_key:
|
243
243
|
specification_version: 4
|
244
244
|
summary: A redis-based URL rewriting engine
|