Sha256: ac09d174816df91da51dc852785db715c310617af16b2c37b3dee708c584382e

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

Shindo.tests('Excon response header support') do
  env_init

  with_rackup('response_header.ru') do

    tests('Response#get_header') do
      connection = nil
      response = nil

      tests('with variable header capitalization') do

        tests('response.get_header("mixedcase-header")').returns('MixedCase') do
          connection = Excon.new('http://foo.com:8080', :proxy => 'http://127.0.0.1:9292')
          response = connection.request(:method => :get, :path => '/foo')

          response.get_header("mixedcase-header")
        end

        tests('response.get_header("uppercase-header")').returns('UPPERCASE') do
          response.get_header("uppercase-header")
        end

        tests('response.get_header("lowercase-header")').returns('lowercase') do
          response.get_header("lowercase-header")
        end

      end

      tests('when provided key capitalization varies') do

        tests('response.get_header("MIXEDCASE-HEADER")').returns('MixedCase') do
          response.get_header("MIXEDCASE-HEADER")
        end

        tests('response.get_header("MiXeDcAsE-hEaDeR")').returns('MixedCase') do
          response.get_header("MiXeDcAsE-hEaDeR")
        end

      end

      tests('when header is unavailable') do

        tests('response.get_header("missing")').returns(nil) do
          response.get_header("missing")
        end

      end

    end

  end

  env_restore
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
excon-0.32.1 tests/header_tests.rb
excon-0.32.0 tests/header_tests.rb
excon-0.31.0 tests/header_tests.rb