summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-07-10 17:00:17 +0900
committergit <[email protected]>2024-07-10 23:06:08 +0000
commit4e6463ad7a56d7cf55726ff913129790b942ffb9 ()
treed05c6c3c347fd40746cb3ebed2df4e8fdf1f4c30 /test/net
parent87a45af1050c07bccf09cb03eb1ce420b62baede (diff)
[ruby/net-http] Support chunked data and fixed test failure with multipart/form-data
https://.com/ruby/net-http/commit/b38c2795a9
-rw-r--r--test/net/http/test_http.rb2
-rw-r--r--test/net/http/utils.rb17
2 files changed, 17 insertions, 2 deletions
@@ -843,6 +843,7 @@ Content-Type: application/octet-stream
__EOM__
start {|http|
_test_set_form_urlencoded(http, data.reject{|k,v|!v.is_a?(String)})
_test_set_form_multipart(http, false, data, expected)
_test_set_form_multipart(http, true, data, expected)
}
@@ -887,6 +888,7 @@ __EOM__
expected.sub!(/<filename>/, filename)
expected.sub!(/<data>/, $test_net_http_data)
start {|http|
data.each{|k,v|v.rewind rescue nil}
req = Net::HTTP::Post.new('/')
req.set_form(data, 'multipart/form-data')
@@ -96,8 +96,12 @@ module TestNetHTTPUtils
@path, @query = parse_path_and_query(path)
@headers = headers
@socket = socket
- if method == 'POST' && @path == '/continue'
- @body = read_body
@query = @body.split('&').each_with_object({}) do |pair, hash|
key, value = pair.split('=')
hash[key] = value
@@ -148,6 +152,15 @@ module TestNetHTTPUtils
return unless content_length && content_length > 0
@socket.read(content_length)
end
end
class Response