http 4.0.3 → 4.0.4
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/CHANGES.md +7 -0
- data/lib/http/client.rb +0 -8
- data/lib/http/features/auto_deflate.rb +5 -0
- data/lib/http/version.rb +1 -1
- data/spec/lib/http/client_spec.rb +13 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 3c750c774b9ba9cef7d527d45863f20afe38fb2dada51404f555b3465c9d2ba5
         | 
| 4 | 
            +
              data.tar.gz: c0421af748f924466afe818a52dc7a02598010446aa1c91e40ac02ca82278b43
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 6a7e7d036484d7145f5cc8a5c077dbed71783125ebeedeb5965c0648a01d0dc596baed4b209a150a1e0848d3002eb285f16fe804c74ecca90a97d3a4f1871d5a
         | 
| 7 | 
            +
              data.tar.gz: fb1c8d8c5ca3c4b8aa5f863d789e47516c8e19dc2ad4f132b8be8509b766fc0e3a8d3ddddc1233db8fc816dc6bc6f0acff80ead1fb5515e1d48cb10b4fd031f9
         | 
    
        data/CHANGES.md
    CHANGED
    
    
    
        data/lib/http/client.rb
    CHANGED
    
    | @@ -160,14 +160,6 @@ module HTTP | |
| 160 160 | 
             
                    headers[Headers::COOKIE] = cookies
         | 
| 161 161 | 
             
                  end
         | 
| 162 162 |  | 
| 163 | 
            -
                  if (auto_deflate = opts.feature(:auto_deflate))
         | 
| 164 | 
            -
                    # We need to delete Content-Length header. It will be set automatically
         | 
| 165 | 
            -
                    # by HTTP::Request::Writer
         | 
| 166 | 
            -
                    headers.delete(Headers::CONTENT_LENGTH)
         | 
| 167 | 
            -
             | 
| 168 | 
            -
                    headers[Headers::CONTENT_ENCODING] = auto_deflate.method
         | 
| 169 | 
            -
                  end
         | 
| 170 | 
            -
             | 
| 171 163 | 
             
                  headers
         | 
| 172 164 | 
             
                end
         | 
| 173 165 |  | 
| @@ -20,6 +20,11 @@ module HTTP | |
| 20 20 |  | 
| 21 21 | 
             
                  def wrap_request(request)
         | 
| 22 22 | 
             
                    return request unless method
         | 
| 23 | 
            +
                    return request if request.body.size.zero?
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    # We need to delete Content-Length header. It will be set automatically by HTTP::Request::Writer
         | 
| 26 | 
            +
                    request.headers.delete(Headers::CONTENT_LENGTH)
         | 
| 27 | 
            +
                    request.headers[Headers::CONTENT_ENCODING] = method
         | 
| 23 28 |  | 
| 24 29 | 
             
                    Request.new(
         | 
| 25 30 | 
             
                      :version => request.version,
         | 
    
        data/lib/http/version.rb
    CHANGED
    
    
| @@ -234,7 +234,7 @@ RSpec.describe HTTP::Client do | |
| 234 234 |  | 
| 235 235 | 
             
                context "when :auto_deflate was specified" do
         | 
| 236 236 | 
             
                  let(:headers) { {"Content-Length" => "12"} }
         | 
| 237 | 
            -
                  let(:client)  { described_class.new :headers => headers, :features => {:auto_deflate => {}} }
         | 
| 237 | 
            +
                  let(:client)  { described_class.new :headers => headers, :features => {:auto_deflate => {}}, :body => "foo" }
         | 
| 238 238 |  | 
| 239 239 | 
             
                  it "deletes Content-Length header" do
         | 
| 240 240 | 
             
                    expect(client).to receive(:perform) do |req, _|
         | 
| @@ -251,6 +251,18 @@ RSpec.describe HTTP::Client do | |
| 251 251 |  | 
| 252 252 | 
             
                    client.request(:get, "http://example.com/")
         | 
| 253 253 | 
             
                  end
         | 
| 254 | 
            +
             | 
| 255 | 
            +
                  context "and there is no body" do
         | 
| 256 | 
            +
                    let(:client) { described_class.new :headers => headers, :features => {:auto_deflate => {}} }
         | 
| 257 | 
            +
             | 
| 258 | 
            +
                    it "doesn't set Content-Encoding header" do
         | 
| 259 | 
            +
                      expect(client).to receive(:perform) do |req, _|
         | 
| 260 | 
            +
                        expect(req.headers).not_to include "Content-Encoding"
         | 
| 261 | 
            +
                      end
         | 
| 262 | 
            +
             | 
| 263 | 
            +
                      client.request(:get, "http://example.com/")
         | 
| 264 | 
            +
                    end
         | 
| 265 | 
            +
                  end
         | 
| 254 266 | 
             
                end
         | 
| 255 267 | 
             
              end
         | 
| 256 268 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: http
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4.0. | 
| 4 | 
            +
              version: 4.0.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tony Arcieri
         | 
| @@ -11,7 +11,7 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2019- | 
| 14 | 
            +
            date: 2019-02-12 00:00:00.000000000 Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: http_parser.rb
         | 
| @@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 197 197 | 
             
                - !ruby/object:Gem::Version
         | 
| 198 198 | 
             
                  version: '0'
         | 
| 199 199 | 
             
            requirements: []
         | 
| 200 | 
            -
            rubygems_version: 3.0. | 
| 200 | 
            +
            rubygems_version: 3.0.1
         | 
| 201 201 | 
             
            signing_key: 
         | 
| 202 202 | 
             
            specification_version: 4
         | 
| 203 203 | 
             
            summary: HTTP should be easy
         |