We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77a21ee commit 7bbded6Copy full SHA for 7bbded6
lib/rack/reverse_proxy.rb
@@ -44,7 +44,15 @@ def call(env)
44
when "PUT", "POST"
45
req = Net::HTTP.const_get(m.capitalize).new(uri.request_uri, headers)
46
req.basic_auth all_opts[:username], all_opts[:password] if all_opts[:username] and all_opts[:password]
47
- req.content_length = rackreq.body.size
+
48
+ if rackreq.body.respond_to?(:read) && rackreq.body.respond_to?(:rewind)
49
+ body = rackreq.body.read
50
+ req.content_length = body.size
51
+ rackreq.body.rewind
52
+ else
53
+ req.content_length = rackreq.body.size
54
+ end
55
56
req.body_stream = rackreq.body
57
else
58
raise "method not supported: #{m}"
0 commit comments