mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* lib/net/http.rb (tokens): forgot to add strip. [ruby-core:11120]
* test/net/http/test_http.rb: test Net::HTTP.post_form. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									a1295b0f79
								
							
						
					
					
						commit
						22d6ff16d3
					
				
					 3 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,9 @@
 | 
			
		|||
Sat May 12 18:26:36 2007  Minero Aoki  <aamine@loveruby.net>
 | 
			
		||||
 | 
			
		||||
	* lib/net/http.rb (tokens): forgot to add strip. [ruby-core:11120]
 | 
			
		||||
 | 
			
		||||
	* test/net/http/test_http.rb: test Net::HTTP.post_form.
 | 
			
		||||
 | 
			
		||||
Fri May 11 15:27:09 2007  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* iseq.c (iseq_data_to_ary): internal IDs must not be exposed.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1503,7 +1503,7 @@ module Net   #:nodoc:
 | 
			
		|||
      return [] unless vals
 | 
			
		||||
      vals.map {|v| v.split(',') }.flatten\
 | 
			
		||||
          .reject {|str| str.strip.empty? }\
 | 
			
		||||
          .map {|tok| tok.downcase }
 | 
			
		||||
          .map {|tok| tok.strip.downcase }
 | 
			
		||||
    end
 | 
			
		||||
    private :tokens
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -139,6 +139,25 @@ module TestNetHTTP_version_1_1_methods
 | 
			
		|||
    assert_equal data, f.string
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_s_post_form
 | 
			
		||||
    res = Net::HTTP.post_form(
 | 
			
		||||
              URI.parse("http://#{config('host')}:#{config('port')}/"),
 | 
			
		||||
              "a" => "x")
 | 
			
		||||
    assert_equal ["a=x"], res.body.split(/[;&]/).sort
 | 
			
		||||
 | 
			
		||||
    res = Net::HTTP.post_form(
 | 
			
		||||
              URI.parse("http://#{config('host')}:#{config('port')}/"),
 | 
			
		||||
              "a" => "x",
 | 
			
		||||
              "b" => "y")
 | 
			
		||||
    assert_equal ["a=x", "b=y"], res.body.split(/[;&]/).sort
 | 
			
		||||
 | 
			
		||||
    res = Net::HTTP.post_form(
 | 
			
		||||
              URI.parse("http://#{config('host')}:#{config('port')}/"),
 | 
			
		||||
              "a" => ["x1", "x2"],
 | 
			
		||||
              "b" => "y")
 | 
			
		||||
    assert_equal ["a=x1", "a=x2", "b=y"], res.body.split(/[;&]/).sort
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -312,6 +331,7 @@ module TestNetHTTPUtils
 | 
			
		|||
      res.body = $test_net_http_data
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # echo server
 | 
			
		||||
    def do_POST(req, res)
 | 
			
		||||
      res['Content-Type'] = req['Content-Type']
 | 
			
		||||
      res.body = req.body
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue