def http_post(url, headers, bodies)
      uri               = URI.parse(url)
      http              = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl      = (uri.scheme == 'https')
      http.open_timeout = options[:open_timeout]
      http.read_timeout = options[:read_timeout]
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE if options[:skip_verification]

      http.start do |session|
        bodies.each do |body|
          request = Net::HTTP::Post.new(uri.request_uri)
          headers.each { |k, v| request.add_field k, v }
          request.body = body
          response     = session.request(request)

          if options[:success].none? { |cl|
            if cl.kind_of?(Class)
              response.kind_of?(cl)
            elsif cl.kind_of?(Fixnum) || cl.kind_of?(String)
              response.code.to_i == cl.to_i
            else
              raise ArgumentError, "Unknown :success value #{cl}"
            end
          }
            raise "Unexpected response from Squash host: #{response.code}"
          end
        end
      end
    end
def http_post(url, headers, bodies)
      uri               = URI.parse(url)
      http              = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl      = (uri.scheme == 'https')
      http.open_timeout = options[:open_timeout]
      http.read_timeout = options[:read_timeout]
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE if options[:skip_verification]

      http.start do |session|
        bodies.each do |body|
          request = Net::HTTP::Post.new(uri.request_uri)
          headers.each { |k, v| request.add_field k, v }
          request.body = body
          response     = session.request(request)

          if options[:success].none? { |cl|
            if cl.kind_of?(Class)
              response.kind_of?(cl)
            elsif cl.kind_of?(Fixnum) || cl.kind_of?(String)
              response.code.to_i == cl.to_i
            else
              raise ArgumentError, "Unknown :success value #{cl}"
            end
          }
            raise "Unexpected response from Squash host: #{response.code}"
          end
        end
      end
    end
Override this method to use your favorite HTTP library. This method receives
 an array of bodies. It is intended that each element of the array be
 transmitted as a separate POST request, _not_ that the bodies be
 concatenated and sent as one request.

 A response of code found in the `:success` option is considered successful.

 @param [String] url The URL to POST to.
 @param [Hash<String, String>] headers The request headers.
 @param [Array<String>] bodies The bodies of each request to POST.
 @raise [StandardError] If a response other than 2xx or 422 is returned.