Skip to content

Commit

Permalink
Handle _test_post__no_data
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed Jul 10, 2024
1 parent cef108a commit 42d21e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/net/http/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ def handle_get(path, headers, socket)
end

def handle_post(path, headers, socket)
body = socket.read(headers['Content-Length'].to_i)
if headers['Content-Length'].to_i > 0
body = socket.read(headers['Content-Length'].to_i)
else
body = ''
end
scheme = headers['X-Request-Scheme'] || 'http'
host = @config['host']
port = socket.addr[1]
Expand Down

0 comments on commit 42d21e1

Please sign in to comment.