rack-matrix_params 0.0.6 → 0.0.7
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/TODO +1 -1
- data/VERSION +1 -1
- data/features/provides_matrix_parameters_like_query_parameters_for_rack.feature +11 -0
- data/features/step_definitions/web_requests_steps.rb +7 -0
- data/features/support/env.rb +14 -0
- data/lib/rack/matrix_params.rb +3 -3
- data/rack-matrix_params.gemspec +2 -0
- data/spec/matrix_params_spec.rb +4 -4
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20bad64eab7a65961c94cde25cc42c5834f85e85
|
4
|
+
data.tar.gz: b9798e1f98451c91b363e19c24648b94ef32e340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4c1c2e0b589b965ff997f5680ed60d175956d98c99399fb58e533deac4ad9161f19d8734e42eabad1a74f517eb56e575d0db81c0da5e668ad10352c47dad95
|
7
|
+
data.tar.gz: f85eaba14a3ec7e051612090f87a07100006bc2be72f97464f1ce844b99a570247d93ff5b777451588c4ea2ace30fcfc83f8f879a9eb2822b39843f1de61aaff
|
data/TODO
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* Look at the POST section - something'
|
1
|
+
* Look at the POST section - something's weird there!
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Feature: Provides matrix URL parameters as if they were given as GET parameters to Rack applications
|
2
|
+
As a developer on the rack platform
|
3
|
+
I want my application to be able to comprehend [matrix parameter][1] style URLs
|
4
|
+
So that I can ensure these parameters are considered when older WWW servers are caching HTTP requests
|
5
|
+
|
6
|
+
Scenario: Matrix parameters are present in the query parameters environment variable
|
7
|
+
When I make a GET request of "/normal/path/with/params;a=1;b=2/in;c=3/the/middle"
|
8
|
+
Then Rack's "PATH_INFO" environment variable is "/normal/path/with/params/in/the/middle"
|
9
|
+
And Rack's "QUERY_STRING" environment variable is "params[a]=1¶ms[b]=2&in[c]=3"
|
10
|
+
|
11
|
+
# [1]: http://www.w3.org/DesignIssues/MatrixURIs.html "Time Berners-Lee's original description of Matrix URIs"
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
2
|
+
require 'rack/matrix_params'
|
3
|
+
require 'rack/test'
|
4
|
+
|
5
|
+
module AppMixin
|
6
|
+
include Rack::Test::Methods
|
7
|
+
def app
|
8
|
+
app = Rack::MatrixParams.new(lambda do |env|
|
9
|
+
[200, {'Content-Type' => 'text/plain'}, ['All good!'] ]
|
10
|
+
end)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
World(AppMixin)
|
data/lib/rack/matrix_params.rb
CHANGED
@@ -70,14 +70,14 @@ module Rack
|
|
70
70
|
if env['REQUEST_METHOD'] != 'POST'
|
71
71
|
|
72
72
|
# Rewrite current path and query string and strip all query params from it
|
73
|
-
env['PATH_INFO'].gsub
|
73
|
+
env['PATH_INFO'] = env['PATH_INFO'].gsub(/;([^\/]*)/, '').gsub(/\?(.*)$/, '')
|
74
74
|
|
75
|
-
env['QUERY_STRING'].gsub
|
75
|
+
env['QUERY_STRING'] = env['QUERY_STRING'].gsub(/;([^\/]*)/, '').freeze
|
76
76
|
|
77
77
|
new_params = matrix_params.collect do |component, params|
|
78
78
|
params.collect do |k,v|
|
79
79
|
"#{component}[#{k}]=#{CGI::escape(v.to_s)}"
|
80
|
-
end
|
80
|
+
end.reverse
|
81
81
|
end.flatten
|
82
82
|
|
83
83
|
# Add matrix params as a regular GET params
|
data/rack-matrix_params.gemspec
CHANGED
data/spec/matrix_params_spec.rb
CHANGED
@@ -4,10 +4,10 @@ describe Rack::MatrixParams do
|
|
4
4
|
include Rack::Test::Methods
|
5
5
|
|
6
6
|
let(:inner_app) do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['All good!'] ]}
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:app) { described_class.new(inner_app) }
|
11
11
|
|
12
12
|
it 'should not change a normal GET query' do
|
13
13
|
get "/?key=value"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-matrix_params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JP Hastings-Spital
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -95,6 +95,20 @@ dependencies:
|
|
95
95
|
- - '>='
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: cucumber
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
98
112
|
description: Rack middleware that populates the params variable with the contents
|
99
113
|
of matrix parameters in a URL
|
100
114
|
email:
|
@@ -112,6 +126,9 @@ files:
|
|
112
126
|
- Rakefile
|
113
127
|
- TODO
|
114
128
|
- VERSION
|
129
|
+
- features/provides_matrix_parameters_like_query_parameters_for_rack.feature
|
130
|
+
- features/step_definitions/web_requests_steps.rb
|
131
|
+
- features/support/env.rb
|
115
132
|
- lib/rack/matrix_params.rb
|
116
133
|
- rack-matrix_params.gemspec
|
117
134
|
- spec/matrix_params_spec.rb
|
@@ -141,5 +158,9 @@ signing_key:
|
|
141
158
|
specification_version: 4
|
142
159
|
summary: Allows the use of matrix URLs in a Rack environment
|
143
160
|
test_files:
|
161
|
+
- features/provides_matrix_parameters_like_query_parameters_for_rack.feature
|
162
|
+
- features/step_definitions/web_requests_steps.rb
|
163
|
+
- features/support/env.rb
|
144
164
|
- spec/matrix_params_spec.rb
|
145
165
|
- spec/spec_helper.rb
|
166
|
+
has_rdoc:
|