Skip to content

Commit 6f0e4bb

Browse files
committed
Ignore Content-Length from env.request_headers
1 parent 00f07de commit 6f0e4bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/async/http/faraday/adapter.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def self.setup_parallel_manager(**options)
111111
SocketError
112112
].freeze
113113

114-
# Create a Farady compatible adapter.
114+
# Create a Faraday compatible adapter.
115115
#
116116
# @parameter timeout [Integer] The timeout for requests.
117117
# @parameter options [Hash] Additional options to pass to the underlying Async::HTTP::Client.
@@ -181,6 +181,12 @@ def perform_request(env)
181181
end
182182

183183
if headers = env.request_headers
184+
# Ignore Content-Length if given, it will be set for us later anyway (lowercased)
185+
if headers.has_key?("Content-Length")
186+
headers = headers.dup
187+
headers.delete("Content-Length")
188+
end
189+
184190
headers = ::Protocol::HTTP::Headers[headers]
185191
end
186192

0 commit comments

Comments
 (0)