2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2004-01-07 06:52:14 -05:00
|
|
|
require 'net/http'
|
|
|
|
require 'test/unit'
|
|
|
|
|
|
|
|
class HTTPHeaderTest < Test::Unit::TestCase
|
|
|
|
|
|
|
|
class C
|
|
|
|
include Net::HTTPHeader
|
|
|
|
def initialize
|
2006-07-26 09:23:40 -04:00
|
|
|
initialize_http_header({})
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
2005-04-20 09:55:26 -04:00
|
|
|
attr_accessor :body
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def setup
|
|
|
|
@c = C.new
|
|
|
|
end
|
|
|
|
|
2017-12-20 07:06:59 -05:00
|
|
|
def test_initialize
|
|
|
|
@c.initialize_http_header("foo"=>"abc")
|
|
|
|
assert_equal "abc", @c["foo"]
|
|
|
|
@c.initialize_http_header("foo"=>"abc", "bar"=>"xyz")
|
|
|
|
assert_equal "xyz", @c["bar"]
|
|
|
|
@c.initialize_http_header([["foo", "abc"]])
|
|
|
|
assert_equal "abc", @c["foo"]
|
|
|
|
@c.initialize_http_header([["foo", "abc"], ["bar","xyz"]])
|
|
|
|
assert_equal "xyz", @c["bar"]
|
|
|
|
assert_raise(NoMethodError){ @c.initialize_http_header("foo"=>[]) }
|
|
|
|
assert_raise(ArgumentError){ @c.initialize_http_header("foo"=>"a\nb") }
|
|
|
|
assert_raise(ArgumentError){ @c.initialize_http_header("foo"=>"a\rb") }
|
|
|
|
assert_raise(ArgumentError){ @c.initialize_http_header("foo"=>"a\xff") }
|
|
|
|
end
|
|
|
|
|
2018-12-10 18:54:14 -05:00
|
|
|
def test_initialize_with_symbol
|
|
|
|
@c.initialize_http_header(foo: "abc")
|
|
|
|
assert_equal "abc", @c["foo"]
|
|
|
|
end
|
|
|
|
|
2004-01-07 06:52:14 -05:00
|
|
|
def test_size
|
|
|
|
assert_equal 0, @c.size
|
|
|
|
@c['a'] = 'a'
|
|
|
|
assert_equal 1, @c.size
|
|
|
|
@c['b'] = 'b'
|
|
|
|
assert_equal 2, @c.size
|
|
|
|
@c['b'] = 'b'
|
|
|
|
assert_equal 2, @c.size
|
|
|
|
@c['c'] = 'c'
|
|
|
|
assert_equal 3, @c.size
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_ASET
|
|
|
|
@c['My-Header'] = 'test string'
|
|
|
|
@c['my-Header'] = 'test string'
|
|
|
|
@c['My-header'] = 'test string'
|
|
|
|
@c['my-header'] = 'test string'
|
|
|
|
@c['MY-HEADER'] = 'test string'
|
|
|
|
assert_equal 1, @c.size
|
|
|
|
|
|
|
|
@c['AaA'] = 'aaa'
|
|
|
|
@c['aaA'] = 'aaa'
|
|
|
|
@c['AAa'] = 'aaa'
|
|
|
|
assert_equal 2, @c.length
|
2017-08-30 13:24:05 -04:00
|
|
|
|
|
|
|
@c['aaa'] = ['aaa', ['bbb', [3]]]
|
|
|
|
assert_equal 2, @c.length
|
|
|
|
assert_equal ['aaa', 'bbb', '3'], @c.get_fields('aaa')
|
|
|
|
|
2017-09-25 10:28:53 -04:00
|
|
|
@c['aaa'] = "aaa\xff"
|
|
|
|
assert_equal 2, @c.length
|
|
|
|
|
2017-08-30 13:24:05 -04:00
|
|
|
assert_raise(ArgumentError){ @c['foo'] = "a\nb" }
|
|
|
|
assert_raise(ArgumentError){ @c['foo'] = ["a\nb"] }
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_AREF
|
|
|
|
@c['My-Header'] = 'test string'
|
|
|
|
assert_equal 'test string', @c['my-header']
|
|
|
|
assert_equal 'test string', @c['MY-header']
|
|
|
|
assert_equal 'test string', @c['my-HEADER']
|
|
|
|
|
|
|
|
@c['Next-Header'] = 'next string'
|
|
|
|
assert_equal 'next string', @c['next-header']
|
|
|
|
end
|
2006-07-26 09:23:40 -04:00
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_add_field
|
2006-07-26 09:23:40 -04:00
|
|
|
@c.add_field 'My-Header', 'a'
|
|
|
|
assert_equal 'a', @c['My-Header']
|
|
|
|
assert_equal ['a'], @c.get_fields('My-Header')
|
|
|
|
@c.add_field 'My-Header', 'b'
|
|
|
|
assert_equal 'a, b', @c['My-Header']
|
|
|
|
assert_equal ['a', 'b'], @c.get_fields('My-Header')
|
|
|
|
@c.add_field 'My-Header', 'c'
|
|
|
|
assert_equal 'a, b, c', @c['My-Header']
|
|
|
|
assert_equal ['a', 'b', 'c'], @c.get_fields('My-Header')
|
|
|
|
@c.add_field 'My-Header', 'd, d'
|
|
|
|
assert_equal 'a, b, c, d, d', @c['My-Header']
|
|
|
|
assert_equal ['a', 'b', 'c', 'd, d'], @c.get_fields('My-Header')
|
2017-08-30 13:24:05 -04:00
|
|
|
assert_raise(ArgumentError){ @c.add_field 'My-Header', "d\nd" }
|
2017-09-25 10:28:53 -04:00
|
|
|
@c.add_field 'My-Header', ['e', ["\xff", 7]]
|
|
|
|
assert_equal "a, b, c, d, d, e, \xff, 7", @c['My-Header']
|
|
|
|
assert_equal ['a', 'b', 'c', 'd, d', 'e', "\xff", '7'], @c.get_fields('My-Header')
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_get_fields
|
2006-07-26 09:23:40 -04:00
|
|
|
@c['My-Header'] = 'test string'
|
|
|
|
assert_equal ['test string'], @c.get_fields('my-header')
|
|
|
|
assert_equal ['test string'], @c.get_fields('My-header')
|
|
|
|
assert_equal ['test string'], @c.get_fields('my-Header')
|
|
|
|
|
|
|
|
assert_nil @c.get_fields('not-found')
|
|
|
|
assert_nil @c.get_fields('Not-Found')
|
|
|
|
|
|
|
|
@c.get_fields('my-header').push 'junk'
|
|
|
|
assert_equal ['test string'], @c.get_fields('my-header')
|
|
|
|
@c.get_fields('my-header').clear
|
|
|
|
assert_equal ['test string'], @c.get_fields('my-header')
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
2016-01-28 20:46:02 -05:00
|
|
|
class D; include Net::HTTPHeader; end
|
|
|
|
|
|
|
|
def test_nil_variable_header
|
2019-07-23 11:24:12 -04:00
|
|
|
assert_nothing_raised do
|
|
|
|
assert_warning("#{__FILE__}:#{__LINE__+1}: warning: net/http: nil HTTP header: Authorization\n") do
|
|
|
|
D.new.initialize_http_header({Authorization: nil})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_duplicated_variable_header
|
|
|
|
assert_nothing_raised do
|
|
|
|
assert_warning("#{__FILE__}:#{__LINE__+1}: warning: net/http: duplicated HTTP header: Authorization\n") do
|
|
|
|
D.new.initialize_http_header({"AUTHORIZATION": "yes", "Authorization": "no"})
|
|
|
|
end
|
|
|
|
end
|
2016-01-28 20:46:02 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_delete
|
2006-07-26 09:23:40 -04:00
|
|
|
@c['My-Header'] = 'test'
|
|
|
|
assert_equal 'test', @c['My-Header']
|
|
|
|
assert_nil @c['not-found']
|
|
|
|
@c.delete 'My-Header'
|
|
|
|
assert_nil @c['My-Header']
|
|
|
|
assert_nil @c['not-found']
|
|
|
|
@c.delete 'My-Header'
|
|
|
|
@c.delete 'My-Header'
|
|
|
|
assert_nil @c['My-Header']
|
|
|
|
assert_nil @c['not-found']
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_each
|
2006-07-26 09:23:40 -04:00
|
|
|
@c['My-Header'] = 'test'
|
|
|
|
@c.each do |k, v|
|
|
|
|
assert_equal 'my-header', k
|
|
|
|
assert_equal 'test', v
|
|
|
|
end
|
|
|
|
@c.each do |k, v|
|
|
|
|
assert_equal 'my-header', k
|
|
|
|
assert_equal 'test', v
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.each
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |k, v|
|
|
|
|
assert_equal 'my-header', k
|
|
|
|
assert_equal 'test', v
|
|
|
|
end
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_each_key
|
2006-07-26 09:23:40 -04:00
|
|
|
@c['My-Header'] = 'test'
|
|
|
|
@c.each_key do |k|
|
|
|
|
assert_equal 'my-header', k
|
|
|
|
end
|
|
|
|
@c.each_key do |k|
|
|
|
|
assert_equal 'my-header', k
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.each_key
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |k|
|
|
|
|
assert_equal 'my-header', k
|
|
|
|
end
|
|
|
|
end
|
2016-05-04 05:46:43 -04:00
|
|
|
|
|
|
|
def test_each_capitalized_name
|
|
|
|
@c['my-header'] = 'test'
|
|
|
|
@c.each_capitalized_name do |k|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
end
|
|
|
|
@c.each_capitalized_name do |k|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.each_capitalized_name
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |k|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
end
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_each_value
|
2006-07-26 09:23:40 -04:00
|
|
|
@c['My-Header'] = 'test'
|
|
|
|
@c.each_value do |v|
|
|
|
|
assert_equal 'test', v
|
|
|
|
end
|
|
|
|
@c.each_value do |v|
|
|
|
|
assert_equal 'test', v
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.each_value
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |v|
|
|
|
|
assert_equal 'test', v
|
|
|
|
end
|
2006-07-26 09:23:40 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_canonical_each
|
|
|
|
@c['my-header'] = ['a', 'b']
|
|
|
|
@c.canonical_each do |k,v|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
assert_equal 'a, b', v
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.canonical_each
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |k,v|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
assert_equal 'a, b', v
|
|
|
|
end
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
2005-01-01 03:45:50 -05:00
|
|
|
def test_each_capitalized
|
|
|
|
@c['my-header'] = ['a', 'b']
|
|
|
|
@c.each_capitalized do |k,v|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
assert_equal 'a, b', v
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.each_capitalized
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |k,v|
|
|
|
|
assert_equal 'My-Header', k
|
|
|
|
assert_equal 'a, b', v
|
|
|
|
end
|
2005-01-01 03:45:50 -05:00
|
|
|
end
|
|
|
|
|
2015-02-08 06:09:44 -05:00
|
|
|
def test_each_capitalized_with_symbol
|
|
|
|
@c[:my_header] = ['a', 'b']
|
|
|
|
@c.each_capitalized do |k,v|
|
|
|
|
assert_equal "My_header", k
|
|
|
|
assert_equal 'a, b', v
|
|
|
|
end
|
2016-05-04 05:46:46 -04:00
|
|
|
e = @c.each_capitalized
|
|
|
|
assert_equal 1, e.size
|
|
|
|
e.each do |k,v|
|
|
|
|
assert_equal 'My_header', k
|
|
|
|
assert_equal 'a, b', v
|
|
|
|
end
|
2015-02-08 06:09:44 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_key?
|
2006-07-26 09:23:40 -04:00
|
|
|
@c['My-Header'] = 'test'
|
|
|
|
assert_equal true, @c.key?('My-Header')
|
|
|
|
assert_equal true, @c.key?('my-header')
|
|
|
|
assert_equal false, @c.key?('Not-Found')
|
|
|
|
assert_equal false, @c.key?('not-found')
|
|
|
|
assert_equal false, @c.key?('')
|
|
|
|
assert_equal false, @c.key?('x' * 1024)
|
2004-03-06 15:35:19 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_to_hash
|
|
|
|
end
|
2004-01-07 06:52:14 -05:00
|
|
|
|
|
|
|
def test_range
|
2012-05-23 09:09:26 -04:00
|
|
|
try_range([1..5], '1-5')
|
|
|
|
try_invalid_range('5-1')
|
|
|
|
try_range([234..567], '234-567')
|
|
|
|
try_range([-5..-1], '-5')
|
|
|
|
try_invalid_range('-0')
|
|
|
|
try_range([1..-1], '1-')
|
|
|
|
try_range([0..0,-1..-1], '0-0,-1')
|
|
|
|
try_range([1..2, 3..4], '1-2,3-4')
|
|
|
|
try_range([1..2, 3..4], '1-2 , 3-4')
|
|
|
|
try_range([1..2, 1..4], '1-2,1-4')
|
|
|
|
|
|
|
|
try_invalid_range('invalid')
|
|
|
|
try_invalid_range(' 12-')
|
|
|
|
try_invalid_range('12- ')
|
|
|
|
try_invalid_range('123-abc')
|
|
|
|
try_invalid_range('abc-123')
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def try_range(r, s)
|
|
|
|
@c['range'] = "bytes=#{s}"
|
2012-05-23 09:09:26 -04:00
|
|
|
assert_equal r, @c.range
|
|
|
|
end
|
|
|
|
|
|
|
|
def try_invalid_range(s)
|
|
|
|
@c['range'] = "bytes=#{s}"
|
|
|
|
assert_raise(Net::HTTPHeaderSyntaxError, s){ @c.range }
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_range=
|
|
|
|
@c.range = 0..499
|
|
|
|
assert_equal 'bytes=0-499', @c['range']
|
|
|
|
@c.range = 0...500
|
|
|
|
assert_equal 'bytes=0-499', @c['range']
|
|
|
|
@c.range = 300
|
|
|
|
assert_equal 'bytes=0-299', @c['range']
|
|
|
|
@c.range = -400
|
|
|
|
assert_equal 'bytes=-400', @c['range']
|
|
|
|
@c.set_range 0, 500
|
|
|
|
assert_equal 'bytes=0-499', @c['range']
|
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_content_range
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_range_length
|
|
|
|
@c['Content-Range'] = "bytes 0-499/1000"
|
|
|
|
assert_equal 500, @c.range_length
|
|
|
|
@c['Content-Range'] = "bytes 1-500/1000"
|
|
|
|
assert_equal 500, @c.range_length
|
|
|
|
@c['Content-Range'] = "bytes 1-1/1000"
|
|
|
|
assert_equal 1, @c.range_length
|
|
|
|
end
|
|
|
|
|
2004-01-07 06:52:14 -05:00
|
|
|
def test_chunked?
|
|
|
|
try_chunked true, 'chunked'
|
|
|
|
try_chunked true, ' chunked '
|
|
|
|
try_chunked true, '(OK)chunked'
|
|
|
|
|
|
|
|
try_chunked false, 'not-chunked'
|
|
|
|
try_chunked false, 'chunked-but-not-chunked'
|
|
|
|
end
|
|
|
|
|
|
|
|
def try_chunked(bool, str)
|
|
|
|
@c['transfer-encoding'] = str
|
|
|
|
assert_equal bool, @c.chunked?
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_content_length
|
|
|
|
@c.delete('content-length')
|
|
|
|
assert_nil @c['content-length']
|
|
|
|
|
|
|
|
try_content_length 500, '500'
|
|
|
|
try_content_length 10000_0000_0000, '1000000000000'
|
|
|
|
try_content_length 123, ' 123'
|
|
|
|
try_content_length 1, '1 23'
|
|
|
|
try_content_length 500, '(OK)500'
|
2008-09-24 13:44:39 -04:00
|
|
|
assert_raise(Net::HTTPHeaderSyntaxError, 'here is no digit, but') {
|
2004-01-07 06:52:14 -05:00
|
|
|
@c['content-length'] = 'no digit'
|
|
|
|
@c.content_length
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def try_content_length(len, str)
|
|
|
|
@c['content-length'] = str
|
|
|
|
assert_equal len, @c.content_length
|
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_content_length=
|
|
|
|
@c.content_length = 0
|
|
|
|
assert_equal 0, @c.content_length
|
|
|
|
@c.content_length = 1
|
|
|
|
assert_equal 1, @c.content_length
|
|
|
|
@c.content_length = 999
|
|
|
|
assert_equal 999, @c.content_length
|
|
|
|
@c.content_length = 10000000000000
|
|
|
|
assert_equal 10000000000000, @c.content_length
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_content_type
|
2006-07-26 09:00:26 -04:00
|
|
|
assert_nil @c.content_type
|
2004-03-06 15:35:19 -05:00
|
|
|
@c.content_type = 'text/html'
|
|
|
|
assert_equal 'text/html', @c.content_type
|
|
|
|
@c.content_type = 'application/pdf'
|
|
|
|
assert_equal 'application/pdf', @c.content_type
|
|
|
|
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
|
|
|
|
assert_equal 'text/html', @c.content_type
|
2006-07-26 09:00:26 -04:00
|
|
|
@c.content_type = 'text'
|
|
|
|
assert_equal 'text', @c.content_type
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_main_type
|
2006-07-26 09:00:26 -04:00
|
|
|
assert_nil @c.main_type
|
2004-03-06 15:35:19 -05:00
|
|
|
@c.content_type = 'text/html'
|
|
|
|
assert_equal 'text', @c.main_type
|
|
|
|
@c.content_type = 'application/pdf'
|
|
|
|
assert_equal 'application', @c.main_type
|
|
|
|
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
|
|
|
|
assert_equal 'text', @c.main_type
|
2006-07-26 09:00:26 -04:00
|
|
|
@c.content_type = 'text'
|
|
|
|
assert_equal 'text', @c.main_type
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_sub_type
|
2006-07-26 09:00:26 -04:00
|
|
|
assert_nil @c.sub_type
|
2004-03-06 15:35:19 -05:00
|
|
|
@c.content_type = 'text/html'
|
|
|
|
assert_equal 'html', @c.sub_type
|
|
|
|
@c.content_type = 'application/pdf'
|
|
|
|
assert_equal 'pdf', @c.sub_type
|
|
|
|
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
|
|
|
|
assert_equal 'html', @c.sub_type
|
2006-07-26 09:00:26 -04:00
|
|
|
@c.content_type = 'text'
|
|
|
|
assert_nil @c.sub_type
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_type_params
|
2006-07-26 09:00:26 -04:00
|
|
|
assert_equal({}, @c.type_params)
|
2004-03-06 15:35:19 -05:00
|
|
|
@c.content_type = 'text/html'
|
|
|
|
assert_equal({}, @c.type_params)
|
|
|
|
@c.content_type = 'application/pdf'
|
|
|
|
assert_equal({}, @c.type_params)
|
|
|
|
@c.set_content_type 'text/html', {'charset' => 'iso-2022-jp'}
|
|
|
|
assert_equal({'charset' => 'iso-2022-jp'}, @c.type_params)
|
2006-07-26 09:00:26 -04:00
|
|
|
@c.content_type = 'text'
|
|
|
|
assert_equal({}, @c.type_params)
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_set_content_type
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2005-04-20 09:55:26 -04:00
|
|
|
def test_form_data=
|
|
|
|
@c.form_data = {"cmd"=>"search", "q"=>"ruby", "max"=>"50"}
|
|
|
|
assert_equal 'application/x-www-form-urlencoded', @c.content_type
|
|
|
|
assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split('&').sort
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_set_form_data
|
|
|
|
@c.set_form_data "cmd"=>"search", "q"=>"ruby", "max"=>"50"
|
|
|
|
assert_equal 'application/x-www-form-urlencoded', @c.content_type
|
|
|
|
assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split('&').sort
|
|
|
|
|
|
|
|
@c.set_form_data "cmd"=>"search", "q"=>"ruby", "max"=>50
|
|
|
|
assert_equal 'application/x-www-form-urlencoded', @c.content_type
|
|
|
|
assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split('&').sort
|
|
|
|
|
|
|
|
@c.set_form_data({"cmd"=>"search", "q"=>"ruby", "max"=>"50"}, ';')
|
|
|
|
assert_equal 'application/x-www-form-urlencoded', @c.content_type
|
|
|
|
assert_equal %w( cmd=search max=50 q=ruby ), @c.body.split(';').sort
|
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_basic_auth
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
2004-03-06 15:35:19 -05:00
|
|
|
def test_proxy_basic_auth
|
2004-01-07 06:52:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|