Class: Seahorse::Client::Plugins::ContentLength::Handler Private
- Defined in:
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- METHODS_WITHOUT_BODY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
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.
Set.new( %w[GET HEAD DELETE OPTIONS TRACE COPY MOVE] )
Instance Attribute Summary
Attributes inherited from
Instance Method Summary collapse
- #call(context) ⇒ Object private
Methods inherited from
This class inherits a constructor from
Instance Method Details
#call(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 20 21 22 23 24 25
# 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) && !.include?(method) context.http_request.headers['Content-Length'] = body.size end @handler.call(context) end