Sha256: b2f57cc7e51727915b3dcd36c3d8841d448105448f7654ef26802e64e18b3083

Contents?: true

Size: 510 Bytes

Versions: 6

Compression:

Stored size: 510 Bytes

Contents

# frozen_string_literal: true

require 'http'
class HTTPAdapter < HTTPBaseAdapter
  def send_get_request
    client.get(parse_uri.to_s)
  end

  def send_head_request
    client.head(parse_uri.to_s)
  end

  def send_post_request
    client.post(parse_uri.to_s, body: @data)
  end

  def send_post_form_request
    client.post(parse_uri.to_s, form: @params)
  end

  private

  def client
    method_name = respond_to?(:with_headers) ? :with_headers : :headers
    ::HTTP.send(method_name, @headers)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
httplog-1.2.2 spec/adapters/http_adapter.rb
httplog-1.2.1 spec/adapters/http_adapter.rb
httplog-1.2.0 spec/adapters/http_adapter.rb
httplog-1.1.1 spec/adapters/http_adapter.rb
httplog-1.1.0 spec/adapters/http_adapter.rb
httplog-1.0.3 spec/adapters/http_adapter.rb