Sha256: 7a41c2dfbe1d22495d45ceca5381d03b8a9ec487d25c992a85ab2eeaa5d32a1d

Contents?: true

Size: 835 Bytes

Versions: 137

Compression:

Stored size: 835 Bytes

Contents

require 'test/testhelp'

class Http10ParserTest < Test::Unit::TestCase
  include Puma

  def test_parse_simple
    parser = HttpParser.new
    req = {}
    http = "GET / HTTP/1.0\r\n\r\n"
    nread = parser.execute(req, http, 0)

    assert nread == http.length, "Failed to parse the full HTTP request"
    assert parser.finished?, "Parser didn't finish"
    assert !parser.error?, "Parser had error"
    assert nread == parser.nread, "Number read returned from execute does not match"

    assert_equal '/', req['REQUEST_PATH']
    assert_equal 'HTTP/1.0', req['HTTP_VERSION']
    assert_equal '/', req['REQUEST_URI']
    assert_equal 'GET', req['REQUEST_METHOD']    
    assert_nil req['FRAGMENT']
    assert_nil req['QUERY_STRING']
    
    parser.reset
    assert parser.nread == 0, "Number read after reset should be 0"
  end
end

Version data entries

137 entries across 137 versions & 5 rubygems

Version Path
puma-2.12.0-java test/test_http10.rb
puma-2.11.3-java test/test_http10.rb
puma-2.11.2-java test/test_http10.rb
puma-2.11.1-java test/test_http10.rb
puma-2.11.1 test/test_http10.rb
puma-2.11.0-java test/test_http10.rb
puma-2.11.0 test/test_http10.rb
puma-2.10.2-java test/test_http10.rb
puma-2.10.2 test/test_http10.rb
puma-2.10.1-java test/test_http10.rb
puma-2.10.1 test/test_http10.rb
puma-2.10.0-java test/test_http10.rb
puma-2.10.0 test/test_http10.rb
wendell-puma-2.9.2 test/test_http10.rb
rsense-server-0.5.18 vendor/gems/puma-2.8.2-java/test/test_http10.rb
puma-2.9.2-java test/test_http10.rb
puma-2.9.2 test/test_http10.rb
puma-2.9.1-java test/test_http10.rb
puma-2.9.1 test/test_http10.rb
puma-2.9.0-java test/test_http10.rb