Sha256: 668c65bff797fb652b38f2a0fd4d5236cb08561e971d5a2fa981d8f529233944

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 KB

Contents

require "spec_helper"
require "mock_server"

IntegrationServer = Rack::Builder.new do
  map "/" do
    run lambda {|env|
      case env["REQUEST_METHOD"]
      when "HEAD" then
        [200, {"Content-Type" => "text/plain", "Content-Length" => "5"}, []]
      when "GET", "POST" then
        [200, {"Content-Type" => "text/plain", "Content-Length" => "5"}, ["Hello"]]
      when "PUT", "DELETE"
        body = "#{env["REQUEST_METHOD"]} is not allowed"
        [200, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s}, [body]]
      end
    }
  end

  map "/x-header" do
    run lambda {|env|
      body = "X-Header is #{env["HTTP_X_HEADER"]}"
      [200, {"Content-Type" => "text/plain", "Content-Length" => body.size.to_s}, [body]]
    }
  end

  map "/auth" do
    map "/basic" do
      run Rack::Auth::Basic do |user, password|
        user == "admin" && password == "secret"
      end
    end

    map "/digest" do
      run Rack::Auth::Digest::MD5 do |username|
        {"admin" => "pwd"}[username]
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 6 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/httpi-0.9.7/spec/integration/server.rb
httpi-2.0.0.rc1 spec/integration/server.rb
httpi-1.1.1 spec/integration/server.rb
httpi-1.1.0 spec/integration/server.rb
httpi-1.0.0 spec/integration/server.rb
httpi-0.9.7 spec/integration/server.rb
httpi-0.9.6 spec/integration/server.rb
regenersis-httpi-0.9.6 spec/integration/server.rb
cs-httpi-0.9.5.2 spec/integration/server.rb
cs-httpi-0.9.5.1 spec/integration/server.rb
httpi-ntlm-0.9.6 spec/integration/server.rb
httpi-0.9.5 spec/integration/server.rb
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/httpi-0.9.4/spec/integration/server.rb
httpi-0.9.4 spec/integration/server.rb
httpi-0.9.3 spec/integration/server.rb
httpi-0.9.2 spec/integration/server.rb
httpi-0.9.1 spec/integration/server.rb
httpi-0.9.0 spec/integration/server.rb
httpi-0.8.0 spec/integration/server.rb
httpi-0.7.9 spec/integration/server.rb