Sha256: 1082d6afaf3e3e61c12566225bdc084f7ba92ac557aa2dc84312c22e9b37fa8a
Contents?: true
Size: 760 Bytes
Versions: 3
Compression:
Stored size: 760 Bytes
Contents
require 'net/http' ## 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. module NetHTTPGenericRequestMonkeypatch 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 end # We prepend the monkeypatch so the patch has access to the original implementation # using `super`. Net::HTTPGenericRequest.prepend(NetHTTPGenericRequestMonkeypatch)
Version data entries
3 entries across 3 versions & 1 rubygems