How do I make HTTParty ignore SSL? How do I make HTTParty ignore SSL? ruby ruby

How do I make HTTParty ignore SSL?


In the latest HTTParty, you can use the verify option to disable SSL verification;

HTTParty.get( "#{ @settings.api_server }#{ url }", :verify => false ).parsed_response


To make HTTParty always skip SSL cert verification, and not have to specify this in every call:

require 'httparty'HTTParty::Basement.default_options.update(verify: false)HTTParty.get("#{@settings.api_ssl_server}#{url1}")HTTParty.get("#{@settings.api_ssl_server}#{url2}")HTTParty.get("#{@settings.api_ssl_server}#{url3}")# ...

You can also do this scoped to a class when including HTTParty as a module:

require 'httparty'class Client  include HTTParty  default_options.update(verify: false)endClient.get("#{@settings.api_ssl_server}#{url1}")Client.get("#{@settings.api_ssl_server}#{url2}")Client.get("#{@settings.api_ssl_server}#{url3}")

Or

require 'httparty'module APIHelpers  class Client    include HTTParty    default_options.update(verify: false)  endendWorld(APIHelpers)Client.get("#{@settings.api_ssl_server}#{url1}")Client.get("#{@settings.api_ssl_server}#{url2}")Client.get("#{@settings.api_ssl_server}#{url3}")


If you want to still send your certificates, use this flag:

verify_peer: false