class Seahorse::Client::Plugins::ContentLength::Handler
@api private
Constants
- METHODS_WITHOUT_BODY
-
github.com/ruby/net-http/blob/master/lib/net/http/requests.rb Methods without body are forwards compatible, because content-length may be set for requests without body but is technically incorrect.
Public Instance Methods
Source
# File lib/seahorse/client/plugins/content_length.rb, line 17 def call(context) body = context.http_request.body method = context.http_request.http_method # We use Net::HTTP with body_stream which doesn't do this by default if body.respond_to?(:size) && !METHODS_WITHOUT_BODY.include?(method) context.http_request.headers['Content-Length'] = body.size end @handler.call(context) end