qeweney 0.17 → 0.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e4dd770959464f8684fe167c3254c81a408dba8cc921c9cf9c2203affe859d4
4
- data.tar.gz: 0b8331d894c8c5dc275cb8cb69fa75848516d168b1baf9a647d1692e7b5abd71
3
+ metadata.gz: 900d05545880fb1fae35a6a0efe6eac62b6b28ff869b552c0e6f793015ffdce5
4
+ data.tar.gz: 13c6efbdf4037b6cc4713e0b3c39b5b8b016f52491d0afc8aafa0955201ced18
5
5
  SHA512:
6
- metadata.gz: 963911778bb98a2280f788522d77942787d5fc9bb80e19df64aef7387d8b6468d353bc91ae5dcfa87834b0656909a32fca1d2ece8ba4f1376e26b96571854222
7
- data.tar.gz: 1f3c71c9d0bb148b265652a9c6516fb65fb4236725394baaa7a61706986afa05ce9371038aa7a4bd3f90ae399967237bd7610ba53303769eab40526f6b4d2a26
6
+ metadata.gz: a6ff612cf01b3b7f89d60c10d925df39f436f0ff5f4d702bec0a7d583ba633eb75248c8ff265d4ab207a4a487a47e1472b20b18cfa0c1d43fde52894d32d5110
7
+ data.tar.gz: d2ff60b4b8797699111800e2b2e0562bd247b856cb6a2e19c7b20f10642a02dd01040a875361c46ad05acb71c4528cab2adf41322363a375211148e759a584e7
data/.github/FUNDING.yml CHANGED
@@ -1 +1 @@
1
- github: ciconia
1
+ github: noteflakes
@@ -8,20 +8,17 @@ jobs:
8
8
  fail-fast: false
9
9
  matrix:
10
10
  os: [ubuntu-latest]
11
- ruby: [2.6, 2.7, 3]
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@v1
19
- - uses: actions/setup-ruby@v1
18
+ - uses: actions/checkout@v3
19
+ - uses: ruby/setup-ruby@v1
20
20
  with:
21
21
  ruby-version: ${{matrix.ruby}}
22
- - name: Install dependencies
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
@@ -1,3 +1,7 @@
1
+ ## 0.18 2022-02-16
2
+
3
+ - Implement `Request#rewrite!` (#2)
4
+
1
5
  ## 0.17 2022-02-10
2
6
 
3
7
  - Fix default return value in `TestAdapter#status`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qeweney (0.17)
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.1)
13
+ escape_utils (1.2.2)
14
14
  minitest (5.11.3)
15
15
  minitest-reporters (1.4.3)
16
16
  ansi
@@ -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
@@ -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 => e
81
+ rescue Errno::ENOENT
82
82
  respond(nil, ':status' => Status::NOT_FOUND)
83
83
  end
84
84
 
@@ -92,12 +92,6 @@ module Qeweney
92
92
  on(route, &block)
93
93
  end
94
94
 
95
- def on_upgrade(protocol, &block)
96
- return unless upgrade_protocol == protocol
97
-
98
- route_found(&block)
99
- end
100
-
101
95
  def on_query_param(key)
102
96
  value = query[key]
103
97
  return unless value
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Qeweney
4
- VERSION = '0.17'
4
+ VERSION = '0.19'
5
5
  end
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 = 'http://github.com/digital-fabric/qeweney'
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
  }
@@ -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.17'
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: 2022-02-10 00:00:00.000000000 Z
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: http://github.com/digital-fabric/qeweney
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.3.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