faraday-gzip 3.0.1-java → 3.0.2-java

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: 1df92d36530a0608d50afebd17a70f7fa3ffa952657ba4dd3064c9abfd816e69
4
- data.tar.gz: f280092b520241d785c612beca9241d058a1e5a8a4828c3d57eead4e01f89e30
3
+ metadata.gz: 8a3411acdc3965fb039bde10d5630f157fb424fa927a6246101d9e7b78d8fe66
4
+ data.tar.gz: 8cb56773469ef2043a28d0ad7f0602f8df51aa6e92f245e5c73e5cfea656a967
5
5
  SHA512:
6
- metadata.gz: 38dbf695901800328fda29a6d7a921711e7c54cee6e16e443b9b7d71e1acf9fedf833b7df7c2e9893d10a3ea18f4590e201c1eec67c97d74008c111ff5dcbe81
7
- data.tar.gz: 157e675d8b6a473b3f84d7504a91a863f93b75be2559e4fe97cd7b7ab43fc69756119a8988412bace723a0e58a1631dc10b06590e1b729a34e626a5d92fc71e5
6
+ metadata.gz: 5c9e2ed168eb9697a3451aba55980dfc8c200b8134ade4d410c0f208a8238e36f7e643e5aa61ff15201b186d458232cda5748a287e32c904fcd73be83a9b5591
7
+ data.tar.gz: a9db00cb41836a55b4d244b8137949d3a0b1b2f2c67b07233f7d923ff58e01e8d3d0757e402b0531752bb362dc0ac5b09f2bc7da686ef8fb1ebed904a76433ba
data/CHANGELOG.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Changelog
2
2
 
3
- ## 3.0.1 (01-Nov-2024)
3
+ ## 3.0.1 / 3.0.2 (01-Nov-2024)
4
4
 
5
- * Minor fix in gemspec
5
+ * Minor fixes in gemspec
6
6
 
7
7
  ## 3.0.0 (29-Oct-2024)
8
8
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module Gzip
5
- VERSION = '3.0.1'
5
+ VERSION = '3.0.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-gzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Ilya Krukowski
@@ -158,16 +158,13 @@ files:
158
158
  - lib/faraday/gzip.rb
159
159
  - lib/faraday/gzip/middleware.rb
160
160
  - lib/faraday/gzip/version.rb
161
- - spec/faraday/gzip/middleware_spec.rb
162
- - spec/faraday/gzip/version_spec.rb
163
- - spec/spec_helper.rb
164
161
  homepage: https://github.com/bodrovis/faraday-gzip
165
162
  licenses:
166
163
  - MIT
167
164
  metadata:
168
165
  bug_tracker_uri: https://github.com/bodrovis/faraday-gzip/issues
169
166
  changelog_uri: https://github.com/bodrovis/faraday-gzip/blob/master/CHANGELOG.md
170
- documentation_uri: http://www.rubydoc.info/gems/faraday-gzip/3.0.1
167
+ documentation_uri: http://www.rubydoc.info/gems/faraday-gzip/3.0.2
171
168
  homepage_uri: https://github.com/bodrovis/faraday-gzip
172
169
  source_code_uri: https://github.com/bodrovis/faraday-gzip
173
170
  rubygems_mfa_required: 'true'
@@ -1,179 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe Faraday::Gzip::Middleware do
4
- require 'brotli' if Faraday::Gzip::Middleware::BROTLI_SUPPORTED
5
-
6
- subject(:middleware) do
7
- described_class.new(->(env) { Faraday::Response.new(env) })
8
- end
9
-
10
- let(:headers) { {} }
11
-
12
- def process(body, content_type = nil, options = {})
13
- env = {
14
- body: body, request: options,
15
- request_headers: Faraday::Utils::Headers.new,
16
- response_headers: Faraday::Utils::Headers.new(headers)
17
- }
18
- env[:response_headers]['content-type'] = content_type if content_type
19
- yield(env) if block_given?
20
- middleware.call(env)
21
- end
22
-
23
- context 'when request' do
24
- it 'sets the Accept-Encoding request header' do
25
- env = process('').env
26
- encodings = Faraday::Gzip::Middleware::BROTLI_SUPPORTED ? 'gzip,deflate,br' : 'gzip,deflate'
27
- expect(env[:request_headers][:accept_encoding]).to eq(encodings)
28
- end
29
-
30
- it 'doesnt overwrite existing Accept-Encoding request header' do
31
- env = process('') do |e|
32
- e[:request_headers][:accept_encoding] = 'zopfli'
33
- end.env
34
- expect(env[:request_headers][:accept_encoding]).to eq('zopfli')
35
- end
36
- end
37
-
38
- context 'when response' do
39
- let(:uncompressed_body) do
40
- '<html><head><title>Rspec</title></head><body>Hello, spec!</body></html>'
41
- end
42
- let(:empty_body) { '' }
43
- let(:gzipped_body) do
44
- io = StringIO.new
45
- gz = Zlib::GzipWriter.new(io)
46
- gz.write(uncompressed_body)
47
- gz.close
48
- res = io.string
49
- res.force_encoding('BINARY')
50
- res
51
- end
52
- let(:deflated_body) do
53
- Zlib::Deflate.deflate(uncompressed_body)
54
- end
55
- let(:raw_deflated_body) do
56
- z = Zlib::Deflate.new(Zlib::DEFAULT_COMPRESSION, -Zlib::MAX_WBITS)
57
- compressed_body = z.deflate(uncompressed_body, Zlib::FINISH)
58
- z.close
59
- compressed_body
60
- end
61
-
62
- if Faraday::Gzip::Middleware::BROTLI_SUPPORTED
63
- let(:brotlied_body) do
64
- Brotli.deflate(uncompressed_body)
65
- end
66
- end
67
-
68
- shared_examples 'compressed response' do
69
- it 'uncompresses the body' do
70
- expect(process(body).body).to eq(uncompressed_body)
71
- end
72
-
73
- it 'sets the Content-Length' do
74
- expect(process(body).headers['Content-Length']).to eq(uncompressed_body.length)
75
- end
76
-
77
- it 'removes the Content-Encoding' do
78
- expect(process(body).headers['Content-Encoding']).to be_nil
79
- end
80
- end
81
-
82
- context 'when gzipped response' do
83
- let(:body) { gzipped_body }
84
- let(:headers) { { 'Content-Encoding' => 'gzip', 'Content-Length' => body.length } }
85
-
86
- it_behaves_like 'compressed response'
87
- end
88
-
89
- context 'when deflated response' do
90
- let(:body) { deflated_body }
91
- let(:headers) { { 'Content-Encoding' => 'deflate', 'Content-Length' => body.length } }
92
-
93
- it_behaves_like 'compressed response'
94
- end
95
-
96
- context 'when raw deflated response' do
97
- let(:body) { raw_deflated_body }
98
- let(:headers) { { 'Content-Encoding' => 'deflate', 'Content-Length' => body.length } }
99
-
100
- it_behaves_like 'compressed response'
101
- end
102
-
103
- if Faraday::Gzip::Middleware::BROTLI_SUPPORTED
104
- context 'when brotlied response' do
105
- let(:body) { brotlied_body }
106
- let(:headers) { { 'Content-Encoding' => 'br', 'Content-Length' => body.length } }
107
-
108
- it_behaves_like 'compressed response'
109
- end
110
- end
111
-
112
- context 'when empty response' do
113
- let(:body) { empty_body }
114
- let(:headers) { { 'Content-Encoding' => 'gzip', 'Content-Length' => body.length } }
115
-
116
- it 'sets the Content-Length' do
117
- expect(process(body).headers['Content-Length']).to eq(empty_body.length)
118
- end
119
-
120
- it 'removes the Content-Encoding' do
121
- expect(process(body).headers['Content-Encoding']).to be_nil
122
- end
123
- end
124
-
125
- context 'when nil response' do
126
- let(:body) { nil }
127
- let(:headers) { { 'Content-Encoding' => 'gzip', 'Content-Length' => 0 } }
128
-
129
- it 'sets the Content-Length' do
130
- expect(process(body).headers['Content-Length']).to eq(0)
131
- end
132
-
133
- it 'removes the Content-Encoding' do
134
- expect(process(body).headers['Content-Encoding']).to be_nil
135
- end
136
- end
137
-
138
- context 'when identity response' do
139
- let(:body) { uncompressed_body }
140
-
141
- it 'does not modify the body' do
142
- expect(process(body).body).to eq(uncompressed_body)
143
- end
144
- end
145
-
146
- context 'when unsupported encoding response' do
147
- let(:body) { 'unsupported' }
148
- let(:headers) { { 'Content-Encoding' => 'unsupported' } }
149
-
150
- it 'does not modify the body' do
151
- expect(process(body).body).to eq(body)
152
- end
153
-
154
- it 'preserves the Content-Encoding header' do
155
- expect(process(body).headers['Content-Encoding']).to eq('unsupported')
156
- end
157
- end
158
-
159
- context 'when no Content-Encoding header' do
160
- let(:body) { uncompressed_body }
161
- let(:headers) { {} }
162
-
163
- it 'does not modify the body' do
164
- expect(process(body).body).to eq(uncompressed_body)
165
- end
166
-
167
- it 'does not add a Content-Encoding header' do
168
- expect(process(body).headers['Content-Encoding']).to be_nil
169
- end
170
- end
171
-
172
- context 'when Content-Length is a string' do
173
- let(:body) { gzipped_body }
174
- let(:headers) { { 'Content-Encoding' => 'gzip', 'Content-Length' => body.length.to_s } }
175
-
176
- it_behaves_like 'compressed response'
177
- end
178
- end
179
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe 'Faraday::Gzip::VERSION' do
4
- subject { Object.const_get(self.class.description) }
5
-
6
- it { is_expected.to match(/^\d+\.\d+\.\d+(\.\w+(\.\d+)?)?$/) }
7
- end
data/spec/spec_helper.rb DELETED
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'faraday'
4
- require 'simplecov'
5
-
6
- SimpleCov.start do
7
- add_filter 'spec/'
8
- add_filter '.github/'
9
- end
10
-
11
- require_relative '../lib/faraday/gzip'
12
-
13
- RSpec.configure do |config|
14
- # Enable flags like --only-failures and --next-failure
15
- config.example_status_persistence_file_path = '.rspec_status'
16
-
17
- # Disable RSpec exposing methods globally on `Module` and `main`
18
- config.disable_monkey_patching!
19
-
20
- config.expect_with :rspec do |c|
21
- c.syntax = :expect
22
- end
23
-
24
- config.order = :random
25
- end