faraday 0.11.0 → 1.4.3
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 +5 -5
 - data/CHANGELOG.md +380 -0
 - data/LICENSE.md +1 -1
 - data/README.md +25 -229
 - data/Rakefile +7 -0
 - data/examples/client_spec.rb +65 -0
 - data/examples/client_test.rb +79 -0
 - data/lib/faraday/adapter/httpclient.rb +83 -59
 - data/lib/faraday/adapter/patron.rb +92 -36
 - data/lib/faraday/adapter/rack.rb +30 -13
 - data/lib/faraday/adapter/test.rb +103 -62
 - data/lib/faraday/adapter/typhoeus.rb +7 -115
 - data/lib/faraday/adapter.rb +77 -22
 - data/lib/faraday/adapter_registry.rb +30 -0
 - data/lib/faraday/autoload.rb +42 -36
 - data/lib/faraday/connection.rb +351 -167
 - data/lib/faraday/dependency_loader.rb +37 -0
 - data/lib/faraday/encoders/flat_params_encoder.rb +105 -0
 - data/lib/faraday/encoders/nested_params_encoder.rb +176 -0
 - data/lib/faraday/error.rb +127 -38
 - data/lib/faraday/file_part.rb +128 -0
 - data/lib/faraday/logging/formatter.rb +105 -0
 - data/lib/faraday/methods.rb +6 -0
 - data/lib/faraday/middleware.rb +19 -25
 - data/lib/faraday/middleware_registry.rb +129 -0
 - data/lib/faraday/options/connection_options.rb +22 -0
 - data/lib/faraday/options/env.rb +181 -0
 - data/lib/faraday/options/proxy_options.rb +32 -0
 - data/lib/faraday/options/request_options.rb +22 -0
 - data/lib/faraday/options/ssl_options.rb +59 -0
 - data/lib/faraday/options.rb +58 -207
 - data/lib/faraday/param_part.rb +53 -0
 - data/lib/faraday/parameters.rb +4 -196
 - data/lib/faraday/rack_builder.rb +84 -48
 - data/lib/faraday/request/authorization.rb +44 -30
 - data/lib/faraday/request/basic_authentication.rb +14 -7
 - data/lib/faraday/request/instrumentation.rb +45 -27
 - data/lib/faraday/request/multipart.rb +88 -45
 - data/lib/faraday/request/retry.rb +211 -126
 - data/lib/faraday/request/token_authentication.rb +15 -10
 - data/lib/faraday/request/url_encoded.rb +43 -23
 - data/lib/faraday/request.rb +94 -32
 - data/lib/faraday/response/logger.rb +22 -69
 - data/lib/faraday/response/raise_error.rb +49 -14
 - data/lib/faraday/response.rb +27 -23
 - data/lib/faraday/utils/headers.rb +139 -0
 - data/lib/faraday/utils/params_hash.rb +61 -0
 - data/lib/faraday/utils.rb +38 -238
 - data/lib/faraday/version.rb +5 -0
 - data/lib/faraday.rb +124 -187
 - data/spec/external_adapters/faraday_specs_setup.rb +14 -0
 - data/spec/faraday/adapter/em_http_spec.rb +47 -0
 - data/spec/faraday/adapter/em_synchrony_spec.rb +16 -0
 - data/spec/faraday/adapter/excon_spec.rb +49 -0
 - data/spec/faraday/adapter/httpclient_spec.rb +73 -0
 - data/spec/faraday/adapter/net_http_spec.rb +64 -0
 - data/spec/faraday/adapter/patron_spec.rb +18 -0
 - data/spec/faraday/adapter/rack_spec.rb +8 -0
 - data/spec/faraday/adapter/test_spec.rb +260 -0
 - data/spec/faraday/adapter/typhoeus_spec.rb +7 -0
 - data/spec/faraday/adapter_registry_spec.rb +28 -0
 - data/spec/faraday/adapter_spec.rb +55 -0
 - data/spec/faraday/composite_read_io_spec.rb +80 -0
 - data/spec/faraday/connection_spec.rb +736 -0
 - data/spec/faraday/error_spec.rb +60 -0
 - data/spec/faraday/middleware_spec.rb +52 -0
 - data/spec/faraday/options/env_spec.rb +70 -0
 - data/spec/faraday/options/options_spec.rb +297 -0
 - data/spec/faraday/options/proxy_options_spec.rb +44 -0
 - data/spec/faraday/options/request_options_spec.rb +19 -0
 - data/spec/faraday/params_encoders/flat_spec.rb +42 -0
 - data/spec/faraday/params_encoders/nested_spec.rb +142 -0
 - data/spec/faraday/rack_builder_spec.rb +345 -0
 - data/spec/faraday/request/authorization_spec.rb +88 -0
 - data/spec/faraday/request/instrumentation_spec.rb +76 -0
 - data/spec/faraday/request/multipart_spec.rb +302 -0
 - data/spec/faraday/request/retry_spec.rb +242 -0
 - data/spec/faraday/request/url_encoded_spec.rb +83 -0
 - data/spec/faraday/request_spec.rb +120 -0
 - data/spec/faraday/response/logger_spec.rb +220 -0
 - data/spec/faraday/response/middleware_spec.rb +68 -0
 - data/spec/faraday/response/raise_error_spec.rb +169 -0
 - data/spec/faraday/response_spec.rb +75 -0
 - data/spec/faraday/utils/headers_spec.rb +82 -0
 - data/spec/faraday/utils_spec.rb +56 -0
 - data/spec/faraday_spec.rb +37 -0
 - data/spec/spec_helper.rb +132 -0
 - data/spec/support/disabling_stub.rb +14 -0
 - data/spec/support/fake_safe_buffer.rb +15 -0
 - data/spec/support/helper_methods.rb +133 -0
 - data/spec/support/shared_examples/adapter.rb +105 -0
 - data/spec/support/shared_examples/params_encoder.rb +18 -0
 - data/spec/support/shared_examples/request_method.rb +262 -0
 - data/spec/support/streaming_response_checker.rb +35 -0
 - data/spec/support/webmock_rack_app.rb +68 -0
 - metadata +164 -16
 - data/lib/faraday/adapter/em_http.rb +0 -243
 - data/lib/faraday/adapter/em_http_ssl_patch.rb +0 -56
 - data/lib/faraday/adapter/em_synchrony/parallel_manager.rb +0 -66
 - data/lib/faraday/adapter/em_synchrony.rb +0 -106
 - data/lib/faraday/adapter/excon.rb +0 -80
 - data/lib/faraday/adapter/net_http.rb +0 -135
 - data/lib/faraday/adapter/net_http_persistent.rb +0 -50
 - data/lib/faraday/upload_io.rb +0 -67
 
| 
         @@ -0,0 +1,262 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            shared_examples 'proxy examples' do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it 'handles requests with proxy' do
         
     | 
| 
      
 5 
     | 
    
         
            +
                res = conn.public_send(http_method, '/')
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                expect(res.status).to eq(200)
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              it 'handles proxy failures' do
         
     | 
| 
      
 11 
     | 
    
         
            +
                request_stub.to_return(status: 407)
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                expect { conn.public_send(http_method, '/') }.to raise_error(Faraday::ProxyAuthError)
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            shared_examples 'a request method' do |http_method|
         
     | 
| 
      
 18 
     | 
    
         
            +
              let(:query_or_body) { method_with_body?(http_method) ? :body : :query }
         
     | 
| 
      
 19 
     | 
    
         
            +
              let(:response) { conn.public_send(http_method, '/') }
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              unless http_method == :head && feature?(:skip_response_body_on_head)
         
     | 
| 
      
 22 
     | 
    
         
            +
                it 'retrieves the response body' do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  res_body = 'test'
         
     | 
| 
      
 24 
     | 
    
         
            +
                  request_stub.to_return(body: res_body)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  expect(conn.public_send(http_method, '/').body).to eq(res_body)
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              it 'handles headers with multiple values' do
         
     | 
| 
      
 30 
     | 
    
         
            +
                request_stub.to_return(headers: { 'Set-Cookie' => 'name=value' })
         
     | 
| 
      
 31 
     | 
    
         
            +
                expect(response.headers['set-cookie']).to eq('name=value')
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              it 'retrieves the response headers' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                request_stub.to_return(headers: { 'Content-Type' => 'text/plain' })
         
     | 
| 
      
 36 
     | 
    
         
            +
                expect(response.headers['Content-Type']).to match(%r{text/plain})
         
     | 
| 
      
 37 
     | 
    
         
            +
                expect(response.headers['content-type']).to match(%r{text/plain})
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              it 'sends user agent' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                request_stub.with(headers: { 'User-Agent' => 'Agent Faraday' })
         
     | 
| 
      
 42 
     | 
    
         
            +
                conn.public_send(http_method, '/', nil, user_agent: 'Agent Faraday')
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
              it 'represents empty body response as blank string' do
         
     | 
| 
      
 46 
     | 
    
         
            +
                expect(response.body).to eq('')
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              it 'handles connection error' do
         
     | 
| 
      
 50 
     | 
    
         
            +
                request_stub.disable
         
     | 
| 
      
 51 
     | 
    
         
            +
                expect { conn.public_send(http_method, 'http://localhost:4') }.to raise_error(Faraday::ConnectionFailed)
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              on_feature :local_socket_binding do
         
     | 
| 
      
 55 
     | 
    
         
            +
                it 'binds local socket' do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  stub_request(http_method, 'http://example.com')
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                  host = '1.2.3.4'
         
     | 
| 
      
 59 
     | 
    
         
            +
                  port = 1234
         
     | 
| 
      
 60 
     | 
    
         
            +
                  conn_options[:request] = { bind: { host: host, port: port } }
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                  conn.public_send(http_method, '/')
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  expect(conn.options[:bind][:host]).to eq(host)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  expect(conn.options[:bind][:port]).to eq(port)
         
     | 
| 
      
 66 
     | 
    
         
            +
                end
         
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
              # context 'when wrong ssl certificate is provided' do
         
     | 
| 
      
 70 
     | 
    
         
            +
              #   let(:ca_file_path) { 'tmp/faraday-different-ca-cert.crt' }
         
     | 
| 
      
 71 
     | 
    
         
            +
              #   before { conn_options.merge!(ssl: { ca_file: ca_file_path }) }
         
     | 
| 
      
 72 
     | 
    
         
            +
              #
         
     | 
| 
      
 73 
     | 
    
         
            +
              #   it do
         
     | 
| 
      
 74 
     | 
    
         
            +
              #     expect { conn.public_send(http_method, '/') }.to raise_error(Faraday::SSLError) # do |ex|
         
     | 
| 
      
 75 
     | 
    
         
            +
              #       expect(ex.message).to include?('certificate')
         
     | 
| 
      
 76 
     | 
    
         
            +
              #     end
         
     | 
| 
      
 77 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 78 
     | 
    
         
            +
              # end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
              on_feature :request_body_on_query_methods do
         
     | 
| 
      
 81 
     | 
    
         
            +
                it 'sends request body' do
         
     | 
| 
      
 82 
     | 
    
         
            +
                  request_stub.with(Hash[:body, 'test'])
         
     | 
| 
      
 83 
     | 
    
         
            +
                  res = if query_or_body == :body
         
     | 
| 
      
 84 
     | 
    
         
            +
                          conn.public_send(http_method, '/', 'test')
         
     | 
| 
      
 85 
     | 
    
         
            +
                        else
         
     | 
| 
      
 86 
     | 
    
         
            +
                          conn.public_send(http_method, '/') do |req|
         
     | 
| 
      
 87 
     | 
    
         
            +
                            req.body = 'test'
         
     | 
| 
      
 88 
     | 
    
         
            +
                          end
         
     | 
| 
      
 89 
     | 
    
         
            +
                        end
         
     | 
| 
      
 90 
     | 
    
         
            +
                  expect(res.env.request_body).to eq('test')
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
              end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
              it 'sends url encoded parameters' do
         
     | 
| 
      
 95 
     | 
    
         
            +
                payload = { name: 'zack' }
         
     | 
| 
      
 96 
     | 
    
         
            +
                request_stub.with(Hash[query_or_body, payload])
         
     | 
| 
      
 97 
     | 
    
         
            +
                res = conn.public_send(http_method, '/', payload)
         
     | 
| 
      
 98 
     | 
    
         
            +
                if query_or_body == :query
         
     | 
| 
      
 99 
     | 
    
         
            +
                  expect(res.env.request_body).to be_nil
         
     | 
| 
      
 100 
     | 
    
         
            +
                else
         
     | 
| 
      
 101 
     | 
    
         
            +
                  expect(res.env.request_body).to eq('name=zack')
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
      
 103 
     | 
    
         
            +
              end
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
              it 'sends url encoded nested parameters' do
         
     | 
| 
      
 106 
     | 
    
         
            +
                payload = { name: { first: 'zack' } }
         
     | 
| 
      
 107 
     | 
    
         
            +
                request_stub.with(Hash[query_or_body, payload])
         
     | 
| 
      
 108 
     | 
    
         
            +
                conn.public_send(http_method, '/', payload)
         
     | 
| 
      
 109 
     | 
    
         
            +
              end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
              # TODO: This needs reimplementation: see https://github.com/lostisland/faraday/issues/718
         
     | 
| 
      
 112 
     | 
    
         
            +
              # Should raise Faraday::TimeoutError
         
     | 
| 
      
 113 
     | 
    
         
            +
              it 'supports timeout option' do
         
     | 
| 
      
 114 
     | 
    
         
            +
                conn_options[:request] = { timeout: 1 }
         
     | 
| 
      
 115 
     | 
    
         
            +
                request_stub.to_timeout
         
     | 
| 
      
 116 
     | 
    
         
            +
                exc = adapter == 'NetHttp' ? Faraday::ConnectionFailed : Faraday::TimeoutError
         
     | 
| 
      
 117 
     | 
    
         
            +
                expect { conn.public_send(http_method, '/') }.to raise_error(exc)
         
     | 
| 
      
 118 
     | 
    
         
            +
              end
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
              # TODO: This needs reimplementation: see https://github.com/lostisland/faraday/issues/718
         
     | 
| 
      
 121 
     | 
    
         
            +
              # Should raise Faraday::ConnectionFailed
         
     | 
| 
      
 122 
     | 
    
         
            +
              it 'supports open_timeout option' do
         
     | 
| 
      
 123 
     | 
    
         
            +
                conn_options[:request] = { open_timeout: 1 }
         
     | 
| 
      
 124 
     | 
    
         
            +
                request_stub.to_timeout
         
     | 
| 
      
 125 
     | 
    
         
            +
                exc = adapter == 'NetHttp' ? Faraday::ConnectionFailed : Faraday::TimeoutError
         
     | 
| 
      
 126 
     | 
    
         
            +
                expect { conn.public_send(http_method, '/') }.to raise_error(exc)
         
     | 
| 
      
 127 
     | 
    
         
            +
              end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
              # Can't send files on get, head and delete methods
         
     | 
| 
      
 130 
     | 
    
         
            +
              if method_with_body?(http_method)
         
     | 
| 
      
 131 
     | 
    
         
            +
                it 'sends files' do
         
     | 
| 
      
 132 
     | 
    
         
            +
                  payload = { uploaded_file: multipart_file }
         
     | 
| 
      
 133 
     | 
    
         
            +
                  request_stub.with(headers: { 'Content-Type' => %r{\Amultipart/form-data} }) do |request|
         
     | 
| 
      
 134 
     | 
    
         
            +
                    # WebMock does not support matching body for multipart/form-data requests yet :(
         
     | 
| 
      
 135 
     | 
    
         
            +
                    # https://github.com/bblimke/webmock/issues/623
         
     | 
| 
      
 136 
     | 
    
         
            +
                    request.body.include?('RubyMultipartPost')
         
     | 
| 
      
 137 
     | 
    
         
            +
                  end
         
     | 
| 
      
 138 
     | 
    
         
            +
                  conn.public_send(http_method, '/', payload)
         
     | 
| 
      
 139 
     | 
    
         
            +
                end
         
     | 
| 
      
 140 
     | 
    
         
            +
              end
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
              on_feature :reason_phrase_parse do
         
     | 
| 
      
 143 
     | 
    
         
            +
                it 'parses the reason phrase' do
         
     | 
| 
      
 144 
     | 
    
         
            +
                  request_stub.to_return(status: [200, 'OK'])
         
     | 
| 
      
 145 
     | 
    
         
            +
                  expect(response.reason_phrase).to eq('OK')
         
     | 
| 
      
 146 
     | 
    
         
            +
                end
         
     | 
| 
      
 147 
     | 
    
         
            +
              end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
              on_feature :compression do
         
     | 
| 
      
 150 
     | 
    
         
            +
                # Accept-Encoding header not sent for HEAD requests as body is not expected in the response.
         
     | 
| 
      
 151 
     | 
    
         
            +
                unless http_method == :head
         
     | 
| 
      
 152 
     | 
    
         
            +
                  it 'handles gzip compression' do
         
     | 
| 
      
 153 
     | 
    
         
            +
                    request_stub.with(headers: { 'Accept-Encoding' => /\bgzip\b/ })
         
     | 
| 
      
 154 
     | 
    
         
            +
                    conn.public_send(http_method, '/')
         
     | 
| 
      
 155 
     | 
    
         
            +
                  end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                  it 'handles deflate compression' do
         
     | 
| 
      
 158 
     | 
    
         
            +
                    request_stub.with(headers: { 'Accept-Encoding' => /\bdeflate\b/ })
         
     | 
| 
      
 159 
     | 
    
         
            +
                    conn.public_send(http_method, '/')
         
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
      
 161 
     | 
    
         
            +
                end
         
     | 
| 
      
 162 
     | 
    
         
            +
              end
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
              on_feature :streaming do
         
     | 
| 
      
 165 
     | 
    
         
            +
                describe 'streaming' do
         
     | 
| 
      
 166 
     | 
    
         
            +
                  let(:streamed) { [] }
         
     | 
| 
      
 167 
     | 
    
         
            +
             
     | 
| 
      
 168 
     | 
    
         
            +
                  context 'when response is empty' do
         
     | 
| 
      
 169 
     | 
    
         
            +
                    it do
         
     | 
| 
      
 170 
     | 
    
         
            +
                      conn.public_send(http_method, '/') do |req|
         
     | 
| 
      
 171 
     | 
    
         
            +
                        req.options.on_data = proc { |*args| streamed << args }
         
     | 
| 
      
 172 
     | 
    
         
            +
                      end
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
                      expect(streamed).to eq([['', 0]])
         
     | 
| 
      
 175 
     | 
    
         
            +
                    end
         
     | 
| 
      
 176 
     | 
    
         
            +
                  end
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
                  context 'when response contains big data' do
         
     | 
| 
      
 179 
     | 
    
         
            +
                    before { request_stub.to_return(body: big_string) }
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                    it 'handles streaming' do
         
     | 
| 
      
 182 
     | 
    
         
            +
                      response = conn.public_send(http_method, '/') do |req|
         
     | 
| 
      
 183 
     | 
    
         
            +
                        req.options.on_data = proc { |*args| streamed << args }
         
     | 
| 
      
 184 
     | 
    
         
            +
                      end
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                      expect(response.body).to eq('')
         
     | 
| 
      
 187 
     | 
    
         
            +
                      check_streaming_response(streamed, chunk_size: 16 * 1024)
         
     | 
| 
      
 188 
     | 
    
         
            +
                    end
         
     | 
| 
      
 189 
     | 
    
         
            +
                  end
         
     | 
| 
      
 190 
     | 
    
         
            +
                end
         
     | 
| 
      
 191 
     | 
    
         
            +
              end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
              on_feature :parallel do
         
     | 
| 
      
 194 
     | 
    
         
            +
                context 'with parallel setup' do
         
     | 
| 
      
 195 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 196 
     | 
    
         
            +
                    @resp1 = nil
         
     | 
| 
      
 197 
     | 
    
         
            +
                    @resp2 = nil
         
     | 
| 
      
 198 
     | 
    
         
            +
                    @payload1 = { a: '1' }
         
     | 
| 
      
 199 
     | 
    
         
            +
                    @payload2 = { b: '2' }
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                    request_stub
         
     | 
| 
      
 202 
     | 
    
         
            +
                      .with(Hash[query_or_body, @payload1])
         
     | 
| 
      
 203 
     | 
    
         
            +
                      .to_return(body: @payload1.to_json)
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
      
 205 
     | 
    
         
            +
                    stub_request(http_method, remote)
         
     | 
| 
      
 206 
     | 
    
         
            +
                      .with(Hash[query_or_body, @payload2])
         
     | 
| 
      
 207 
     | 
    
         
            +
                      .to_return(body: @payload2.to_json)
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
                    conn.in_parallel do
         
     | 
| 
      
 210 
     | 
    
         
            +
                      @resp1 = conn.public_send(http_method, '/', @payload1)
         
     | 
| 
      
 211 
     | 
    
         
            +
                      @resp2 = conn.public_send(http_method, '/', @payload2)
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
                      expect(conn.in_parallel?).to be_truthy
         
     | 
| 
      
 214 
     | 
    
         
            +
                      expect(@resp1.body).to be_nil
         
     | 
| 
      
 215 
     | 
    
         
            +
                      expect(@resp2.body).to be_nil
         
     | 
| 
      
 216 
     | 
    
         
            +
                    end
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                    expect(conn.in_parallel?).to be_falsey
         
     | 
| 
      
 219 
     | 
    
         
            +
                  end
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
                  it 'handles parallel requests status' do
         
     | 
| 
      
 222 
     | 
    
         
            +
                    expect(@resp1&.status).to eq(200)
         
     | 
| 
      
 223 
     | 
    
         
            +
                    expect(@resp2&.status).to eq(200)
         
     | 
| 
      
 224 
     | 
    
         
            +
                  end
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
      
 226 
     | 
    
         
            +
                  unless http_method == :head && feature?(:skip_response_body_on_head)
         
     | 
| 
      
 227 
     | 
    
         
            +
                    it 'handles parallel requests body' do
         
     | 
| 
      
 228 
     | 
    
         
            +
                      expect(@resp1&.body).to eq(@payload1.to_json)
         
     | 
| 
      
 229 
     | 
    
         
            +
                      expect(@resp2&.body).to eq(@payload2.to_json)
         
     | 
| 
      
 230 
     | 
    
         
            +
                    end
         
     | 
| 
      
 231 
     | 
    
         
            +
                  end
         
     | 
| 
      
 232 
     | 
    
         
            +
                end
         
     | 
| 
      
 233 
     | 
    
         
            +
              end
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
              context 'when a proxy is provided as option' do
         
     | 
| 
      
 236 
     | 
    
         
            +
                before do
         
     | 
| 
      
 237 
     | 
    
         
            +
                  conn_options[:proxy] = 'http://env-proxy.com:80'
         
     | 
| 
      
 238 
     | 
    
         
            +
                end
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
                include_examples 'proxy examples'
         
     | 
| 
      
 241 
     | 
    
         
            +
              end
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
              context 'when http_proxy env variable is set' do
         
     | 
| 
      
 244 
     | 
    
         
            +
                let(:proxy_url) { 'http://env-proxy.com:80' }
         
     | 
| 
      
 245 
     | 
    
         
            +
             
     | 
| 
      
 246 
     | 
    
         
            +
                around do |example|
         
     | 
| 
      
 247 
     | 
    
         
            +
                  with_env 'http_proxy' => proxy_url do
         
     | 
| 
      
 248 
     | 
    
         
            +
                    example.run
         
     | 
| 
      
 249 
     | 
    
         
            +
                  end
         
     | 
| 
      
 250 
     | 
    
         
            +
                end
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
                include_examples 'proxy examples'
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
                context 'when the env proxy is ignored' do
         
     | 
| 
      
 255 
     | 
    
         
            +
                  around do |example|
         
     | 
| 
      
 256 
     | 
    
         
            +
                    with_env_proxy_disabled(&example)
         
     | 
| 
      
 257 
     | 
    
         
            +
                  end
         
     | 
| 
      
 258 
     | 
    
         
            +
             
     | 
| 
      
 259 
     | 
    
         
            +
                  include_examples 'proxy examples'
         
     | 
| 
      
 260 
     | 
    
         
            +
                end
         
     | 
| 
      
 261 
     | 
    
         
            +
              end
         
     | 
| 
      
 262 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Faraday
         
     | 
| 
      
 4 
     | 
    
         
            +
              module StreamingResponseChecker
         
     | 
| 
      
 5 
     | 
    
         
            +
                def check_streaming_response(streamed, options = {})
         
     | 
| 
      
 6 
     | 
    
         
            +
                  opts = {
         
     | 
| 
      
 7 
     | 
    
         
            +
                    prefix: '',
         
     | 
| 
      
 8 
     | 
    
         
            +
                    streaming?: true
         
     | 
| 
      
 9 
     | 
    
         
            +
                  }.merge(options)
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  expected_response = opts[:prefix] + big_string
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  chunks, sizes = streamed.transpose
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  # Check that the total size of the chunks (via the last size returned)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # is the same size as the expected_response
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect(sizes.last).to eq(expected_response.bytesize)
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  start_index = 0
         
     | 
| 
      
 20 
     | 
    
         
            +
                  expected_chunks = []
         
     | 
| 
      
 21 
     | 
    
         
            +
                  chunks.each do |actual_chunk|
         
     | 
| 
      
 22 
     | 
    
         
            +
                    expected_chunk = expected_response[start_index..((start_index + actual_chunk.bytesize) - 1)]
         
     | 
| 
      
 23 
     | 
    
         
            +
                    expected_chunks << expected_chunk
         
     | 
| 
      
 24 
     | 
    
         
            +
                    start_index += expected_chunk.bytesize
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  # it's easier to read a smaller portion, so we check that first
         
     | 
| 
      
 28 
     | 
    
         
            +
                  expect(expected_chunks[0][0..255]).to eq(chunks[0][0..255])
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  [expected_chunks, chunks].transpose.each do |expected, actual|
         
     | 
| 
      
 31 
     | 
    
         
            +
                    expect(actual).to eq(expected)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,68 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Rack app used to test the Rack adapter.
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Uses Webmock to check if requests are registered, in which case it returns
         
     | 
| 
      
 5 
     | 
    
         
            +
            # the registered response.
         
     | 
| 
      
 6 
     | 
    
         
            +
            class WebmockRackApp
         
     | 
| 
      
 7 
     | 
    
         
            +
              def call(env)
         
     | 
| 
      
 8 
     | 
    
         
            +
                req_signature = WebMock::RequestSignature.new(
         
     | 
| 
      
 9 
     | 
    
         
            +
                  req_method(env),
         
     | 
| 
      
 10 
     | 
    
         
            +
                  req_uri(env),
         
     | 
| 
      
 11 
     | 
    
         
            +
                  body: req_body(env),
         
     | 
| 
      
 12 
     | 
    
         
            +
                  headers: req_headers(env)
         
     | 
| 
      
 13 
     | 
    
         
            +
                )
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                WebMock::RequestRegistry
         
     | 
| 
      
 16 
     | 
    
         
            +
                  .instance
         
     | 
| 
      
 17 
     | 
    
         
            +
                  .requested_signatures
         
     | 
| 
      
 18 
     | 
    
         
            +
                  .put(req_signature)
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                process_response(req_signature)
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def req_method(env)
         
     | 
| 
      
 24 
     | 
    
         
            +
                env['REQUEST_METHOD'].downcase.to_sym
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              def req_uri(env)
         
     | 
| 
      
 28 
     | 
    
         
            +
                scheme = env['rack.url_scheme']
         
     | 
| 
      
 29 
     | 
    
         
            +
                host = env['SERVER_NAME']
         
     | 
| 
      
 30 
     | 
    
         
            +
                port = env['SERVER_PORT']
         
     | 
| 
      
 31 
     | 
    
         
            +
                path = env['PATH_INFO']
         
     | 
| 
      
 32 
     | 
    
         
            +
                query = env['QUERY_STRING']
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                url = +"#{scheme}://#{host}:#{port}#{path}"
         
     | 
| 
      
 35 
     | 
    
         
            +
                url += "?#{query}" if query
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                uri = WebMock::Util::URI.heuristic_parse(url)
         
     | 
| 
      
 38 
     | 
    
         
            +
                uri.path = uri.normalized_path.gsub('[^:]//', '/')
         
     | 
| 
      
 39 
     | 
    
         
            +
                uri
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
              def req_headers(env)
         
     | 
| 
      
 43 
     | 
    
         
            +
                http_headers = env.select { |k, _| k.start_with?('HTTP_') }
         
     | 
| 
      
 44 
     | 
    
         
            +
                                  .map { |k, v| [k[5..-1], v] }
         
     | 
| 
      
 45 
     | 
    
         
            +
                                  .to_h
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                special_headers = Faraday::Adapter::Rack::SPECIAL_HEADERS
         
     | 
| 
      
 48 
     | 
    
         
            +
                http_headers.merge(env.select { |k, _| special_headers.include?(k) })
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              def req_body(env)
         
     | 
| 
      
 52 
     | 
    
         
            +
                env['rack.input'].read
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
              def process_response(req_signature)
         
     | 
| 
      
 56 
     | 
    
         
            +
                res = WebMock::StubRegistry.instance.response_for_request(req_signature)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                if res.nil? && req_signature.uri.host == 'localhost'
         
     | 
| 
      
 59 
     | 
    
         
            +
                  raise Faraday::ConnectionFailed, 'Trying to connect to localhost'
         
     | 
| 
      
 60 
     | 
    
         
            +
                end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                raise WebMock::NetConnectNotAllowedError, req_signature unless res
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                raise Faraday::TimeoutError if res.should_timeout
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                [res.status[0], res.headers || {}, [res.body || '']]
         
     | 
| 
      
 67 
     | 
    
         
            +
              end
         
     | 
| 
      
 68 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,87 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: faraday
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.4.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
     | 
    
         
            -
            -  
     | 
| 
      
 7 
     | 
    
         
            +
            - "@technoweenie"
         
     | 
| 
      
 8 
     | 
    
         
            +
            - "@iMacTia"
         
     | 
| 
      
 9 
     | 
    
         
            +
            - "@olleolleolle"
         
     | 
| 
       8 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2021-06-24 00:00:00.000000000 Z
         
     | 
| 
       12 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 15 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 16 
     | 
    
         
            +
              name: faraday-em_http
         
     | 
| 
      
 17 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 22 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 26 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 27 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 28 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 29 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 30 
     | 
    
         
            +
              name: faraday-em_synchrony
         
     | 
| 
      
 31 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 32 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 33 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 34 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 35 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 36 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 37 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 38 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 39 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 40 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 42 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 43 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 44 
     | 
    
         
            +
              name: faraday-excon
         
     | 
| 
      
 45 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 46 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 47 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 48 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 49 
     | 
    
         
            +
                    version: '1.1'
         
     | 
| 
      
 50 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 51 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 52 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 53 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 54 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 55 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 56 
     | 
    
         
            +
                    version: '1.1'
         
     | 
| 
      
 57 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 58 
     | 
    
         
            +
              name: faraday-net_http
         
     | 
| 
      
 59 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 60 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 61 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 62 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 63 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 64 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 65 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 66 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 67 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 68 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 69 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 70 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 71 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 72 
     | 
    
         
            +
              name: faraday-net_http_persistent
         
     | 
| 
      
 73 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 74 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 75 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 76 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 77 
     | 
    
         
            +
                    version: '1.1'
         
     | 
| 
      
 78 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 79 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 80 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 81 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 82 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 83 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 84 
     | 
    
         
            +
                    version: '1.1'
         
     | 
| 
       13 
85 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
86 
     | 
    
         
             
              name: multipart-post
         
     | 
| 
       15 
87 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -30,33 +102,58 @@ dependencies: 
     | 
|
| 
       30 
102 
     | 
    
         
             
                - - "<"
         
     | 
| 
       31 
103 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
104 
     | 
    
         
             
                    version: '3'
         
     | 
| 
      
 105 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 106 
     | 
    
         
            +
              name: ruby2_keywords
         
     | 
| 
      
 107 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 108 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 109 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 110 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 111 
     | 
    
         
            +
                    version: 0.0.4
         
     | 
| 
      
 112 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 113 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 114 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 115 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 116 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 117 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 118 
     | 
    
         
            +
                    version: 0.0.4
         
     | 
| 
       33 
119 
     | 
    
         
             
            description: 
         
     | 
| 
       34 
120 
     | 
    
         
             
            email: technoweenie@gmail.com
         
     | 
| 
       35 
121 
     | 
    
         
             
            executables: []
         
     | 
| 
       36 
122 
     | 
    
         
             
            extensions: []
         
     | 
| 
       37 
123 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       38 
124 
     | 
    
         
             
            files:
         
     | 
| 
      
 125 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
       39 
126 
     | 
    
         
             
            - LICENSE.md
         
     | 
| 
       40 
127 
     | 
    
         
             
            - README.md
         
     | 
| 
      
 128 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 129 
     | 
    
         
            +
            - examples/client_spec.rb
         
     | 
| 
      
 130 
     | 
    
         
            +
            - examples/client_test.rb
         
     | 
| 
       41 
131 
     | 
    
         
             
            - lib/faraday.rb
         
     | 
| 
       42 
132 
     | 
    
         
             
            - lib/faraday/adapter.rb
         
     | 
| 
       43 
     | 
    
         
            -
            - lib/faraday/adapter/em_http.rb
         
     | 
| 
       44 
     | 
    
         
            -
            - lib/faraday/adapter/em_http_ssl_patch.rb
         
     | 
| 
       45 
     | 
    
         
            -
            - lib/faraday/adapter/em_synchrony.rb
         
     | 
| 
       46 
     | 
    
         
            -
            - lib/faraday/adapter/em_synchrony/parallel_manager.rb
         
     | 
| 
       47 
     | 
    
         
            -
            - lib/faraday/adapter/excon.rb
         
     | 
| 
       48 
133 
     | 
    
         
             
            - lib/faraday/adapter/httpclient.rb
         
     | 
| 
       49 
     | 
    
         
            -
            - lib/faraday/adapter/net_http.rb
         
     | 
| 
       50 
     | 
    
         
            -
            - lib/faraday/adapter/net_http_persistent.rb
         
     | 
| 
       51 
134 
     | 
    
         
             
            - lib/faraday/adapter/patron.rb
         
     | 
| 
       52 
135 
     | 
    
         
             
            - lib/faraday/adapter/rack.rb
         
     | 
| 
       53 
136 
     | 
    
         
             
            - lib/faraday/adapter/test.rb
         
     | 
| 
       54 
137 
     | 
    
         
             
            - lib/faraday/adapter/typhoeus.rb
         
     | 
| 
      
 138 
     | 
    
         
            +
            - lib/faraday/adapter_registry.rb
         
     | 
| 
       55 
139 
     | 
    
         
             
            - lib/faraday/autoload.rb
         
     | 
| 
       56 
140 
     | 
    
         
             
            - lib/faraday/connection.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - lib/faraday/dependency_loader.rb
         
     | 
| 
      
 142 
     | 
    
         
            +
            - lib/faraday/encoders/flat_params_encoder.rb
         
     | 
| 
      
 143 
     | 
    
         
            +
            - lib/faraday/encoders/nested_params_encoder.rb
         
     | 
| 
       57 
144 
     | 
    
         
             
            - lib/faraday/error.rb
         
     | 
| 
      
 145 
     | 
    
         
            +
            - lib/faraday/file_part.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - lib/faraday/logging/formatter.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - lib/faraday/methods.rb
         
     | 
| 
       58 
148 
     | 
    
         
             
            - lib/faraday/middleware.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - lib/faraday/middleware_registry.rb
         
     | 
| 
       59 
150 
     | 
    
         
             
            - lib/faraday/options.rb
         
     | 
| 
      
 151 
     | 
    
         
            +
            - lib/faraday/options/connection_options.rb
         
     | 
| 
      
 152 
     | 
    
         
            +
            - lib/faraday/options/env.rb
         
     | 
| 
      
 153 
     | 
    
         
            +
            - lib/faraday/options/proxy_options.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/faraday/options/request_options.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            - lib/faraday/options/ssl_options.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lib/faraday/param_part.rb
         
     | 
| 
       60 
157 
     | 
    
         
             
            - lib/faraday/parameters.rb
         
     | 
| 
       61 
158 
     | 
    
         
             
            - lib/faraday/rack_builder.rb
         
     | 
| 
       62 
159 
     | 
    
         
             
            - lib/faraday/request.rb
         
     | 
| 
         @@ -70,29 +167,80 @@ files: 
     | 
|
| 
       70 
167 
     | 
    
         
             
            - lib/faraday/response.rb
         
     | 
| 
       71 
168 
     | 
    
         
             
            - lib/faraday/response/logger.rb
         
     | 
| 
       72 
169 
     | 
    
         
             
            - lib/faraday/response/raise_error.rb
         
     | 
| 
       73 
     | 
    
         
            -
            - lib/faraday/upload_io.rb
         
     | 
| 
       74 
170 
     | 
    
         
             
            - lib/faraday/utils.rb
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 171 
     | 
    
         
            +
            - lib/faraday/utils/headers.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - lib/faraday/utils/params_hash.rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            - lib/faraday/version.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - spec/external_adapters/faraday_specs_setup.rb
         
     | 
| 
      
 175 
     | 
    
         
            +
            - spec/faraday/adapter/em_http_spec.rb
         
     | 
| 
      
 176 
     | 
    
         
            +
            - spec/faraday/adapter/em_synchrony_spec.rb
         
     | 
| 
      
 177 
     | 
    
         
            +
            - spec/faraday/adapter/excon_spec.rb
         
     | 
| 
      
 178 
     | 
    
         
            +
            - spec/faraday/adapter/httpclient_spec.rb
         
     | 
| 
      
 179 
     | 
    
         
            +
            - spec/faraday/adapter/net_http_spec.rb
         
     | 
| 
      
 180 
     | 
    
         
            +
            - spec/faraday/adapter/patron_spec.rb
         
     | 
| 
      
 181 
     | 
    
         
            +
            - spec/faraday/adapter/rack_spec.rb
         
     | 
| 
      
 182 
     | 
    
         
            +
            - spec/faraday/adapter/test_spec.rb
         
     | 
| 
      
 183 
     | 
    
         
            +
            - spec/faraday/adapter/typhoeus_spec.rb
         
     | 
| 
      
 184 
     | 
    
         
            +
            - spec/faraday/adapter_registry_spec.rb
         
     | 
| 
      
 185 
     | 
    
         
            +
            - spec/faraday/adapter_spec.rb
         
     | 
| 
      
 186 
     | 
    
         
            +
            - spec/faraday/composite_read_io_spec.rb
         
     | 
| 
      
 187 
     | 
    
         
            +
            - spec/faraday/connection_spec.rb
         
     | 
| 
      
 188 
     | 
    
         
            +
            - spec/faraday/error_spec.rb
         
     | 
| 
      
 189 
     | 
    
         
            +
            - spec/faraday/middleware_spec.rb
         
     | 
| 
      
 190 
     | 
    
         
            +
            - spec/faraday/options/env_spec.rb
         
     | 
| 
      
 191 
     | 
    
         
            +
            - spec/faraday/options/options_spec.rb
         
     | 
| 
      
 192 
     | 
    
         
            +
            - spec/faraday/options/proxy_options_spec.rb
         
     | 
| 
      
 193 
     | 
    
         
            +
            - spec/faraday/options/request_options_spec.rb
         
     | 
| 
      
 194 
     | 
    
         
            +
            - spec/faraday/params_encoders/flat_spec.rb
         
     | 
| 
      
 195 
     | 
    
         
            +
            - spec/faraday/params_encoders/nested_spec.rb
         
     | 
| 
      
 196 
     | 
    
         
            +
            - spec/faraday/rack_builder_spec.rb
         
     | 
| 
      
 197 
     | 
    
         
            +
            - spec/faraday/request/authorization_spec.rb
         
     | 
| 
      
 198 
     | 
    
         
            +
            - spec/faraday/request/instrumentation_spec.rb
         
     | 
| 
      
 199 
     | 
    
         
            +
            - spec/faraday/request/multipart_spec.rb
         
     | 
| 
      
 200 
     | 
    
         
            +
            - spec/faraday/request/retry_spec.rb
         
     | 
| 
      
 201 
     | 
    
         
            +
            - spec/faraday/request/url_encoded_spec.rb
         
     | 
| 
      
 202 
     | 
    
         
            +
            - spec/faraday/request_spec.rb
         
     | 
| 
      
 203 
     | 
    
         
            +
            - spec/faraday/response/logger_spec.rb
         
     | 
| 
      
 204 
     | 
    
         
            +
            - spec/faraday/response/middleware_spec.rb
         
     | 
| 
      
 205 
     | 
    
         
            +
            - spec/faraday/response/raise_error_spec.rb
         
     | 
| 
      
 206 
     | 
    
         
            +
            - spec/faraday/response_spec.rb
         
     | 
| 
      
 207 
     | 
    
         
            +
            - spec/faraday/utils/headers_spec.rb
         
     | 
| 
      
 208 
     | 
    
         
            +
            - spec/faraday/utils_spec.rb
         
     | 
| 
      
 209 
     | 
    
         
            +
            - spec/faraday_spec.rb
         
     | 
| 
      
 210 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 211 
     | 
    
         
            +
            - spec/support/disabling_stub.rb
         
     | 
| 
      
 212 
     | 
    
         
            +
            - spec/support/fake_safe_buffer.rb
         
     | 
| 
      
 213 
     | 
    
         
            +
            - spec/support/helper_methods.rb
         
     | 
| 
      
 214 
     | 
    
         
            +
            - spec/support/shared_examples/adapter.rb
         
     | 
| 
      
 215 
     | 
    
         
            +
            - spec/support/shared_examples/params_encoder.rb
         
     | 
| 
      
 216 
     | 
    
         
            +
            - spec/support/shared_examples/request_method.rb
         
     | 
| 
      
 217 
     | 
    
         
            +
            - spec/support/streaming_response_checker.rb
         
     | 
| 
      
 218 
     | 
    
         
            +
            - spec/support/webmock_rack_app.rb
         
     | 
| 
      
 219 
     | 
    
         
            +
            homepage: https://lostisland.github.io/faraday
         
     | 
| 
       76 
220 
     | 
    
         
             
            licenses:
         
     | 
| 
       77 
221 
     | 
    
         
             
            - MIT
         
     | 
| 
       78 
     | 
    
         
            -
            metadata: 
     | 
| 
      
 222 
     | 
    
         
            +
            metadata:
         
     | 
| 
      
 223 
     | 
    
         
            +
              homepage_uri: https://lostisland.github.io/faraday
         
     | 
| 
      
 224 
     | 
    
         
            +
              changelog_uri: https://github.com/lostisland/faraday/releases/tag/v1.4.3
         
     | 
| 
      
 225 
     | 
    
         
            +
              source_code_uri: https://github.com/lostisland/faraday
         
     | 
| 
      
 226 
     | 
    
         
            +
              bug_tracker_uri: https://github.com/lostisland/faraday/issues
         
     | 
| 
       79 
227 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       80 
228 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       81 
229 
     | 
    
         
             
            require_paths:
         
     | 
| 
       82 
230 
     | 
    
         
             
            - lib
         
     | 
| 
      
 231 
     | 
    
         
            +
            - spec/external_adapters
         
     | 
| 
       83 
232 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       84 
233 
     | 
    
         
             
              requirements:
         
     | 
| 
       85 
234 
     | 
    
         
             
              - - ">="
         
     | 
| 
       86 
235 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       87 
     | 
    
         
            -
                  version: ' 
     | 
| 
      
 236 
     | 
    
         
            +
                  version: '2.4'
         
     | 
| 
       88 
237 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       89 
238 
     | 
    
         
             
              requirements:
         
     | 
| 
       90 
239 
     | 
    
         
             
              - - ">="
         
     | 
| 
       91 
240 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       92 
241 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       93 
242 
     | 
    
         
             
            requirements: []
         
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
            rubygems_version: 2.4.5
         
     | 
| 
      
 243 
     | 
    
         
            +
            rubygems_version: 3.0.3.1
         
     | 
| 
       96 
244 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       97 
245 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       98 
246 
     | 
    
         
             
            summary: HTTP/REST API client library.
         
     |