Sha256: bbcfdb12e5e554033a6db8d0fa512abac35eabdce23e665b0b275530baf3647c

Contents?: true

Size: 730 Bytes

Versions: 19

Compression:

Stored size: 730 Bytes

Contents

require "test_helper"
require "net_http_hacked"

class NetHttpHackedTest < Test::Unit::TestCase
  
  def test_net_http_hacked
    req = Net::HTTP::Get.new("/")
    http = Net::HTTP.start("www.iana.org", "80")

    # Response code
    res = http.begin_request_hacked(req)
    assert res.code == "200"

    # Headers
    headers = {}
    res.each_header { |k, v| headers[k] = v }

    assert headers.size > 0
    assert headers["content-type"] == "text/html; charset=UTF-8"
    assert !headers["date"].nil?

    # Body
    chunks = []
    res.read_body do |chunk|
      chunks << chunk
    end

    assert chunks.size > 0
    chunks.each do |chunk|
      assert chunk.is_a?(String)
    end

    http.end_request_hacked
  end
  
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rack-proxy-0.7.7/test/net_http_hacked_test.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rack-proxy-0.7.7/test/net_http_hacked_test.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rack-proxy-0.7.7/test/net_http_hacked_test.rb
rack-proxy-0.7.7 test/net_http_hacked_test.rb
rack-proxy-0.7.6 test/net_http_hacked_test.rb
rack-proxy-0.7.5 test/net_http_hacked_test.rb
rack-proxy-0.7.4 test/net_http_hacked_test.rb
rack-proxy-0.7.2 test/net_http_hacked_test.rb
rack-proxy-0.7.1 test/net_http_hacked_test.rb
rack-proxy-0.7.0 test/net_http_hacked_test.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/rack-proxy-0.6.5/test/net_http_hacked_test.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/rack-proxy-0.6.5/test/net_http_hacked_test.rb
rack-proxy-0.6.5 test/net_http_hacked_test.rb
rack-proxy-0.6.4 test/net_http_hacked_test.rb
rack-proxy-0.6.3 test/net_http_hacked_test.rb
rack-proxy-0.6.2 test/net_http_hacked_test.rb
rack-proxy-0.6.1 test/net_http_hacked_test.rb
rack-proxy-0.6.0 test/net_http_hacked_test.rb
rack-proxy-0.5.18 test/net_http_hacked_test.rb