qeweney 0.17 → 0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -1
- data/.github/workflows/test.yml +4 -7
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/qeweney/request_info.rb +17 -1
- data/lib/qeweney/response.rb +1 -1
- data/lib/qeweney/routing.rb +0 -6
- data/lib/qeweney/version.rb +1 -1
- data/qeweney.gemspec +1 -1
- data/test/test_request_info.rb +22 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 900d05545880fb1fae35a6a0efe6eac62b6b28ff869b552c0e6f793015ffdce5
|
4
|
+
data.tar.gz: 13c6efbdf4037b6cc4713e0b3c39b5b8b016f52491d0afc8aafa0955201ced18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6ff612cf01b3b7f89d60c10d925df39f436f0ff5f4d702bec0a7d583ba633eb75248c8ff265d4ab207a4a487a47e1472b20b18cfa0c1d43fde52894d32d5110
|
7
|
+
data.tar.gz: d2ff60b4b8797699111800e2b2e0562bd247b856cb6a2e19c7b20f10642a02dd01040a875361c46ad05acb71c4528cab2adf41322363a375211148e759a584e7
|
data/.github/FUNDING.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
github:
|
1
|
+
github: noteflakes
|
data/.github/workflows/test.yml
CHANGED
@@ -8,20 +8,17 @@ jobs:
|
|
8
8
|
fail-fast: false
|
9
9
|
matrix:
|
10
10
|
os: [ubuntu-latest]
|
11
|
-
ruby: [
|
11
|
+
ruby: ['3.0', 3.1, 3.2]
|
12
12
|
|
13
13
|
name: >-
|
14
14
|
${{matrix.os}}, ${{matrix.ruby}}
|
15
15
|
|
16
16
|
runs-on: ${{matrix.os}}
|
17
17
|
steps:
|
18
|
-
- uses: actions/checkout@
|
19
|
-
- uses:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- uses: ruby/setup-ruby@v1
|
20
20
|
with:
|
21
21
|
ruby-version: ${{matrix.ruby}}
|
22
|
-
|
23
|
-
run: |
|
24
|
-
gem install bundler
|
25
|
-
bundle install
|
22
|
+
bundler-cache: true
|
26
23
|
- name: Run tests
|
27
24
|
run: bundle exec rake test
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
qeweney (0.
|
4
|
+
qeweney (0.19)
|
5
5
|
escape_utils (~> 1.2.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -10,7 +10,7 @@ GEM
|
|
10
10
|
ansi (1.5.0)
|
11
11
|
benchmark-ips (2.8.4)
|
12
12
|
builder (3.2.4)
|
13
|
-
escape_utils (1.2.
|
13
|
+
escape_utils (1.2.2)
|
14
14
|
minitest (5.11.3)
|
15
15
|
minitest-reporters (1.4.3)
|
16
16
|
ansi
|
data/lib/qeweney/request_info.rb
CHANGED
@@ -34,6 +34,22 @@ module Qeweney
|
|
34
34
|
@scheme ||= @headers[':scheme']
|
35
35
|
end
|
36
36
|
|
37
|
+
# Rewrites the request path by replacing the given src with the given
|
38
|
+
# replacement.
|
39
|
+
#
|
40
|
+
# @param src [String, Regexp] src pattern
|
41
|
+
# @param replacement [String] replacement
|
42
|
+
# @return [Qeweney::Request] self
|
43
|
+
def rewrite!(src, replacement)
|
44
|
+
@headers[':path'] = @headers[':path']
|
45
|
+
.gsub(src, replacement)
|
46
|
+
.gsub('//', '/')
|
47
|
+
@path = nil
|
48
|
+
@uri = nil
|
49
|
+
@full_uri = nil
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
37
53
|
def uri
|
38
54
|
@uri ||= URI.parse(@headers[':path'] || '')
|
39
55
|
end
|
@@ -179,4 +195,4 @@ module Qeweney
|
|
179
195
|
end
|
180
196
|
end
|
181
197
|
end
|
182
|
-
end
|
198
|
+
end
|
data/lib/qeweney/response.rb
CHANGED
@@ -78,7 +78,7 @@ module Qeweney
|
|
78
78
|
(opts[:headers] ||= {})['Content-Type'] ||= mime_type if mime_type
|
79
79
|
|
80
80
|
respond_with_static_file(full_path, etag, last_modified, opts)
|
81
|
-
rescue Errno::ENOENT
|
81
|
+
rescue Errno::ENOENT
|
82
82
|
respond(nil, ':status' => Status::NOT_FOUND)
|
83
83
|
end
|
84
84
|
|
data/lib/qeweney/routing.rb
CHANGED
data/lib/qeweney/version.rb
CHANGED
data/qeweney.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.author = 'Sharon Rosner'
|
9
9
|
s.email = 'sharon@noteflakes.com'
|
10
10
|
s.files = `git ls-files`.split
|
11
|
-
s.homepage = '
|
11
|
+
s.homepage = 'https://github.com/digital-fabric/qeweney'
|
12
12
|
s.metadata = {
|
13
13
|
"source_code_uri" => "https://github.com/digital-fabric/qeweney"
|
14
14
|
}
|
data/test/test_request_info.rb
CHANGED
@@ -65,4 +65,26 @@ class RequestInfoTest < MiniTest::Test
|
|
65
65
|
'signin_ref' => '/'
|
66
66
|
}, r.cookies)
|
67
67
|
end
|
68
|
+
|
69
|
+
def test_rewrite!
|
70
|
+
r = Qeweney.mock(
|
71
|
+
':scheme' => 'https',
|
72
|
+
'host' => 'foo.bar',
|
73
|
+
':path' => '/hey/ho?a=b&c=d'
|
74
|
+
)
|
75
|
+
|
76
|
+
assert_equal '/hey/ho', r.path
|
77
|
+
assert_equal URI.parse('/hey/ho?a=b&c=d'), r.uri
|
78
|
+
assert_equal 'https://foo.bar/hey/ho?a=b&c=d', r.full_uri
|
79
|
+
|
80
|
+
r.rewrite!('/hhh', '/')
|
81
|
+
assert_equal '/hey/ho', r.path
|
82
|
+
assert_equal URI.parse('/hey/ho?a=b&c=d'), r.uri
|
83
|
+
assert_equal 'https://foo.bar/hey/ho?a=b&c=d', r.full_uri
|
84
|
+
|
85
|
+
r.rewrite!('/hey', '/')
|
86
|
+
assert_equal '/ho', r.path
|
87
|
+
assert_equal URI.parse('/ho?a=b&c=d'), r.uri
|
88
|
+
assert_equal 'https://foo.bar/ho?a=b&c=d', r.full_uri
|
89
|
+
end
|
68
90
|
end
|
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.19'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sharon Rosner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: escape_utils
|
@@ -115,7 +115,7 @@ files:
|
|
115
115
|
- test/test_response.rb
|
116
116
|
- test/test_routing.rb
|
117
117
|
- test/test_test_adapter.rb
|
118
|
-
homepage:
|
118
|
+
homepage: https://github.com/digital-fabric/qeweney
|
119
119
|
licenses:
|
120
120
|
- MIT
|
121
121
|
metadata:
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
142
|
+
rubygems_version: 3.5.16
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Qeweney - cross library HTTP request / response API
|