qeweney 0.13.1 → 0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/qeweney/request_info.rb +2 -0
- data/lib/qeweney/routing.rb +12 -10
- data/lib/qeweney/version.rb +1 -1
- data/test/test_routing.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f515f9637f0d993c9dfbea4d425695f76915871ad0c62e090cbb31a4a57b4a7
|
4
|
+
data.tar.gz: 80a6bf6da6a0d2b85771deff0cb24ad9bcf389e4af37042a6fd62c215617a657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d08170e772a3fad93d49a06bc8ee6c656e5057e5368d3dfba6687d1f838dff50e7cfb8895315480f3f85ea519d8ee0ae20a3a480ee26293bd86bfec2c4912918
|
7
|
+
data.tar.gz: a1918424e95a70891eb4f8fb1b163cdf62167bb3847c16192be9f8dffd95c77513cca4f0e6d4a759275b14bc7891d770585b3625b4601177195ade7a731f6814
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/qeweney/request_info.rb
CHANGED
@@ -164,6 +164,8 @@ module Qeweney
|
|
164
164
|
MAX_PARAMETER_VALUE_SIZE = 2**20 # 1MB
|
165
165
|
|
166
166
|
def parse_urlencoded_form_data(body)
|
167
|
+
return {} unless body
|
168
|
+
|
167
169
|
body.force_encoding(Encoding::UTF_8) unless body.encoding == Encoding::UTF_8
|
168
170
|
body.split('&').each_with_object({}) do |i, m|
|
169
171
|
raise 'Invalid parameter format' unless i =~ PARAMETER_RE
|
data/lib/qeweney/routing.rb
CHANGED
@@ -29,22 +29,24 @@ module Qeweney
|
|
29
29
|
@path_parts.empty? ? '/' : "/#{@path_parts[@path_parts_idx..-1].join('/')}"
|
30
30
|
end
|
31
31
|
|
32
|
-
def enter_route
|
33
|
-
@path_parts_idx +=
|
32
|
+
def enter_route(depth = 1)
|
33
|
+
@path_parts_idx += depth
|
34
34
|
end
|
35
35
|
|
36
|
-
def leave_route
|
37
|
-
@path_parts_idx -=
|
36
|
+
def leave_route(depth = 1)
|
37
|
+
@path_parts_idx -= depth
|
38
38
|
end
|
39
39
|
|
40
|
-
def on(route
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
def on(route, &block)
|
41
|
+
return route_found(&block) unless route
|
42
|
+
|
43
|
+
route_parts = route.split('/')
|
44
|
+
route_length = route_parts.size
|
45
|
+
return unless @path_parts[@path_parts_idx, route_length] == route_parts
|
44
46
|
|
45
|
-
enter_route
|
47
|
+
enter_route(route_length)
|
46
48
|
route_found(&block)
|
47
|
-
leave_route
|
49
|
+
leave_route(route_length)
|
48
50
|
end
|
49
51
|
|
50
52
|
def is(route = '/', &block)
|
data/lib/qeweney/version.rb
CHANGED
data/test/test_routing.rb
CHANGED
@@ -114,4 +114,16 @@ class RoutingTest < MiniTest::Test
|
|
114
114
|
assert_equal '/baz/d/e/f', default_relative_path
|
115
115
|
assert_equal [[:respond, r, '/d/e/f', {}]], r.response_calls
|
116
116
|
end
|
117
|
+
|
118
|
+
def test_well_known
|
119
|
+
app = Qeweney.route do |r|
|
120
|
+
r.on('.well-known/acme-challenge') { r.respond(r.route_relative_path) }
|
121
|
+
r.default { r.respond('not found') }
|
122
|
+
end
|
123
|
+
|
124
|
+
r = Qeweney.mock(':path' => '/.well-known/acme-challenge/foo')
|
125
|
+
app.(r)
|
126
|
+
assert_equal [[:respond, r, '/foo', {}]], r.response_calls
|
127
|
+
end
|
117
128
|
end
|
129
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qeweney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.14'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|