Sha256: effdb28bdfea6f14cc829c92ead0140473883ef623404debf875fd663677b40f

Contents?: true

Size: 1.32 KB

Versions: 24

Compression:

Stored size: 1.32 KB

Contents

Shindo.tests('Excon redirector support') do
  env_init

  tests("request(:method => :get, :path => '/old').body").returns('new') do
    Excon.stub(
      { :path => '/old' },
      {
        :headers  => { 'Location' => 'http://127.0.0.1:9292/new' },
        :body     => 'old',
        :status   => 301
      }
    )

    Excon.stub(
      { :path => '/new' },
      {
        :body     => 'new',
        :status   => 200
      }
    )

    Excon.get(
      'http://127.0.0.1:9292',
      :path         => '/old',
      :middlewares  => Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower],
      :mock         => true
    ).body
  end

  env_restore
end

Shindo.tests('Excon redirect support for relative Location headers') do
  env_init

  tests("request(:method => :get, :path => '/old').body").returns('new') do
    Excon.stub(
      { :path => '/old' },
      {
        :headers  => { 'Location' => '/new' },
        :body     => 'old',
        :status   => 301
      }
    )

    Excon.stub(
      { :path => '/new' },
      {
        :body     => 'new',
        :status   => 200
      }
    )

    Excon.get(
      'http://127.0.0.1:9292',
      :path         => '/old',
      :middlewares  => Excon.defaults[:middlewares] + [Excon::Middleware::RedirectFollower],
      :mock         => true
    ).body
  end

  env_restore
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
excon-0.44.2 tests/middlewares/redirect_follower_tests.rb
excon-0.44.1 tests/middlewares/redirect_follower_tests.rb
excon-0.44.0 tests/middlewares/redirect_follower_tests.rb
excon-0.43.0 tests/middlewares/redirect_follower_tests.rb
excon-0.42.1 tests/middlewares/redirect_follower_tests.rb
excon-0.42.0 tests/middlewares/redirect_follower_tests.rb
excon-0.41.0 tests/middlewares/redirect_follower_tests.rb
excon-0.40.0 tests/middlewares/redirect_follower_tests.rb
excon-0.39.6 tests/middlewares/redirect_follower_tests.rb
excon-0.39.5 tests/middlewares/redirect_follower_tests.rb
excon-0.39.4 tests/middlewares/redirect_follower_tests.rb
excon-0.39.3 tests/middlewares/redirect_follower_tests.rb
excon-0.39.2 tests/middlewares/redirect_follower_tests.rb
excon-0.39.1 tests/middlewares/redirect_follower_tests.rb
excon-0.39.0 tests/middlewares/redirect_follower_tests.rb
excon-0.38.0 tests/middlewares/redirect_follower_tests.rb
excon-0.37.0 tests/middlewares/redirect_follower_tests.rb
excon-0.36.0 tests/middlewares/redirect_follower_tests.rb
excon-0.35.0 tests/middlewares/redirect_follower_tests.rb
excon-0.34.0 tests/middlewares/redirect_follower_tests.rb