Sha256: bddd70066d1b079f3e9c1682c0b763b154d623f3ed637eed9c99e983cf48387a

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Http2" do
  it "should be able to do multipart-requests." do
    require "knj/http2"
    require "knj/php"
    
    http = Knj::Http2.new(:host => "www.partyworm.dk")
    resp = http.post_multipart("multipart_test.php", {
      "test_var" => "true"
    })
    
    if resp.body != "multipart-test-test_var=true"
      raise "Expected body to be 'test_var=true' but it wasnt: '#{resp.body}'."
    end
  end
  
  it "it should be able to handle keep-alive correctly" do
    require "knj/http2"
    
    urls = [
      "?show=users_search",
      "?show=users_online",
      "?show=drinksdb",
      "?show=forum&fid=9&tid=1917&page=0"
    ]
    urls = ["robots.txt"]
    
    http = Knj::Http2.new(:host => "www.partyworm.dk", :debug => true)
    0.upto(105) do |count|
      url = urls[rand(urls.size)]
      #print "Doing request #{count} of 200 (#{url}).\n"
      res = http.get(url)
      raise "Body was empty." if res.body.to_s.length <= 0
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
knjrbfw-0.0.23 spec/http2_spec.rb
knjrbfw-0.0.22 spec/http2_spec.rb
knjrbfw-0.0.21 spec/http2_spec.rb
knjrbfw-0.0.20 spec/http2_spec.rb
knjrbfw-0.0.19 spec/http2_spec.rb
knjrbfw-0.0.18 spec/http2_spec.rb
knjrbfw-0.0.17 spec/http2_spec.rb
knjrbfw-0.0.16 spec/http2_spec.rb
knjrbfw-0.0.15 spec/http2_spec.rb
knjrbfw-0.0.14 spec/http2_spec.rb
knjrbfw-0.0.13 spec/http2_spec.rb
knjrbfw-0.0.12 spec/http2_spec.rb
knjrbfw-0.0.11 spec/http2_spec.rb
knjrbfw-0.0.10 spec/http2_spec.rb
knjrbfw-0.0.9 spec/http2_spec.rb