Skip to content

savonrb/httpi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c9c6e06 · Jul 14, 2024
Jul 6, 2024
Feb 11, 2024
Jul 14, 2024
Jul 6, 2024
Oct 4, 2012
Sep 11, 2010
Jul 14, 2024
Feb 11, 2024
Sep 24, 2010
Feb 13, 2024
Aug 1, 2017
Feb 16, 2024
Jul 12, 2024

Repository files navigation

HTTPI

A common interface for Ruby's HTTP libraries. This project is now in maintenance mode. For new projects, we recommend faraday.

Documentation

Development

Installation

HTTPI is available through Rubygems and can be installed via:

$ gem install httpi

or add it to your Gemfile like this:

gem 'httpi', '~> 4.0.0'

Usage example

require "httpi"

# create a request object
request = HTTPI::Request.new
request.url = "http://example.com"

# and pass it to a request method
HTTPI.get(request)

# use a specific adapter per request
HTTPI.get(request, :curb)

# or specify a global adapter to use
HTTPI.adapter = :httpclient

# and execute arbitary requests
HTTPI.request(:custom, request)

# add a client setup block that will be called before each request
HTTPI.adapter = :httpclient
HTTPI.adapter_client_setup = proc do |x|
  x.ssl_config.set_default_paths
  x.force_basic_auth = true
end
# ...
HTTPI.get(request) do |x|
  x.force_basic_auth = false
end

SOCKS Proxy Support

To use the the SOCKS proxy support, please add the socksify gem to your gemfile, and add the following code:

require 'socksify'
require 'socksify/http'

to your project.

Documentation

Continue reading at https://www.rubydoc.info/gems/httpi