File: escape_path_tests.rb

package info (click to toggle)
ruby-excon 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,240 kB
  • sloc: ruby: 7,970; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 1,322 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Shindo.tests('Excon Decompress Middleware') do
  env_init
  with_rackup('basic.ru') do
    tests('encoded uri passed to connection') do
      tests('GET /echo%20dirty').returns(200) do
        connection = Excon::Connection.new({
          :host             => '127.0.0.1',
          :hostname         => '127.0.0.1',
          :middlewares      => Excon.defaults[:middlewares] + [Excon::Middleware::EscapePath],
          :nonblock         => false,
          :port             => 9292,
          :scheme           => 'http',
          :ssl_verify_peer  => false
        })
        response = connection.request(:method => :get, :path => '/echo%20dirty')
        response[:status]
      end
    end

    tests('unencoded uri passed to connection') do
      tests('GET /echo dirty').returns(200) do
        connection = Excon::Connection.new({
          :host             => '127.0.0.1',
          :hostname         => '127.0.0.1',
          :middlewares      => Excon.defaults[:middlewares] + [Excon::Middleware::EscapePath],
          :nonblock         => false,
          :port             => 9292,
          :scheme           => 'http',
          :ssl_verify_peer  => false
        })
        response = connection.request(:method => :get, :path => '/echo dirty')
        response[:status]
      end
    end
  end
end