Module: NetHTTPGenericRequestMonkeypatch

Defined in:
spaceship/lib/spaceship/helper/net_http_generic_request.rb

Overview

monkey-patch Net::HTTP

Certain apple endpoints return 415 responses if a Content-Type is supplied. Net::HTTP will default a content-type if none is provided by faraday This monkey-patch allows us to leave out the content-type if we do not specify one.

Instance Method Summary collapse

Instance Method Details

#supply_default_content_typeObject



9
10
11
12
13
14
15
# File 'spaceship/lib/spaceship/helper/net_http_generic_request.rb', line 9

def supply_default_content_type
  # Return no content type if we communicating with an apple.com domain
  return if !self['host'].nil? && self['host'].end_with?('.apple.com')

  # Otherwise use the default implementation
  super
end