Module: Seahorse::Client::NetHttp::Patches::PatchDefaultContentType Private

Defined in:
lib/seahorse/client/net_http/patches.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

For requests with bodys, Net::HTTP sets a default content type of:

'application/x-www-form-urlencoded'

There are cases where we should not send content type at all. Even when no body is supplied, Net::HTTP uses a default empty body and sets it anyway. This patch disables the behavior when a Thread local variable is set.

Instance Method Summary collapse

Instance Method Details

#supply_default_content_typeObject

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.


27
28
29
30
31
# File 'lib/seahorse/client/net_http/patches.rb', line 27

def supply_default_content_type
  return if Thread.current[:net_http_skip_default_content_type]

  super
end