All Projects → httprb → Http

httprb / Http

Licence: mit
HTTP (The Gem! a.k.a. http.rb) is an easy-to-use client library for making requests from Ruby. It uses a simple method chaining system for building requests, similar to Python's Requests.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Http

Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+3.68%)
Mutual labels:  http-client, client
Httpie
As easy as /aitch-tee-tee-pie/ 🥧 Modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more. https://twitter.com/httpie
Stars: ✭ 53,052 (+1794.71%)
Mutual labels:  http-client, client
Gentleman
Full-featured, plugin-driven, extensible HTTP client toolkit for Go
Stars: ✭ 886 (-68.36%)
Mutual labels:  http-client, client
electron-request
Zero-dependency, Lightweight HTTP request client for Electron or Node.js
Stars: ✭ 45 (-98.39%)
Mutual labels:  client, http-client
Request Compose
Composable HTTP Client
Stars: ✭ 80 (-97.14%)
Mutual labels:  http-client, client
Http Client
An HTTP client engine, intended as a base layer for more user-friendly packages.
Stars: ✭ 214 (-92.36%)
Mutual labels:  http-client
Urllib3
Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more.
Stars: ✭ 2,857 (+2.04%)
Mutual labels:  http-client
Phpnats
A PHP client for the NATSio cloud messaging system.
Stars: ✭ 209 (-92.54%)
Mutual labels:  client
Watsontcp
WatsonTcp is the easiest way to build TCP-based clients and servers in C#.
Stars: ✭ 209 (-92.54%)
Mutual labels:  client
Elastic
An Elasticsearch REST API client for Rust
Stars: ✭ 248 (-91.14%)
Mutual labels:  http-client
Meli
🐝 experimental terminal mail client, mirror of https://git.meli.delivery/meli/meli.git https://crates.io/crates/meli
Stars: ✭ 242 (-91.36%)
Mutual labels:  client
Avhttp
avhttp is concurrent http downloader
Stars: ✭ 232 (-91.71%)
Mutual labels:  http-client
Simplenetwork
simple TCP server / client C++ linux socket
Stars: ✭ 225 (-91.96%)
Mutual labels:  client
Pika
Pure Python RabbitMQ/AMQP 0-9-1 client library
Stars: ✭ 2,866 (+2.36%)
Mutual labels:  client
H Opc
OPC client made simpler, for UA and DA
Stars: ✭ 209 (-92.54%)
Mutual labels:  client
Zipcelx
Turns JSON data into `.xlsx` files in the browser
Stars: ✭ 246 (-91.21%)
Mutual labels:  client
Aleph
Asynchronous communication for Clojure
Stars: ✭ 2,389 (-14.68%)
Mutual labels:  http-client
Use Ssr
☯️ React hook to determine if you are on the server, browser, or react native
Stars: ✭ 230 (-91.79%)
Mutual labels:  client
Jenkins Cli
Jenkins CLI allows you manage your Jenkins as an easy way
Stars: ✭ 245 (-91.25%)
Mutual labels:  client
Http Client
[Deprecated] Event-driven, streaming HTTP client for ReactPHP.
Stars: ✭ 228 (-91.86%)
Mutual labels:  http-client

http.rb

Gem Version MIT licensed Build Status Code Climate

Documentation

About

HTTP (The Gem! a.k.a. http.rb) is an easy-to-use client library for making requests from Ruby. It uses a simple method chaining system for building requests, similar to Python's Requests.

Under the hood, http.rb uses the llhttp parser, a fast HTTP parsing native extension. This library isn't just yet another wrapper around Net::HTTP. It implements the HTTP protocol natively and outsources the parsing to native extensions.

Why http.rb?

  • Clean API: http.rb offers an easy-to-use API that should be a breath of fresh air after using something like Net::HTTP.

  • Maturity: http.rb is one of the most mature Ruby HTTP clients, supporting features like persistent connections and fine-grained timeouts.

  • Performance: using native parsers and a clean, lightweight implementation, http.rb achieves high performance while implementing HTTP in Ruby instead of C.

Installation

Add this line to your application's Gemfile:

gem "http"

And then execute:

$ bundle

Or install it yourself as:

$ gem install http

Inside of your Ruby program do:

require "http"

...to pull it in as a dependency.

Documentation

Please see the http.rb wiki for more detailed documentation and usage notes.

The following API documentation is also available:

Basic Usage

Here's some simple examples to get you started:

>> HTTP.get("https://github.com").to_s
=> "\n\n\n<!DOCTYPE html>\n<html lang=\"en\" class=\"\">\n  <head prefix=\"o..."

That's all it takes! To obtain an HTTP::Response object instead of the response body, all we have to do is omit the #to_s on the end:

>> HTTP.get("https://github.com")
=> #<HTTP::Response/1.1 200 OK {"Server"=>"GitHub.com", "Date"=>"Tue, 10 May...>

We can also obtain an HTTP::Response::Body object for this response:

>> HTTP.get("https://github.com").body
=> #<HTTP::Response::Body:3ff756862b48 @streaming=false>

The response body can be streamed with HTTP::Response::Body#readpartial. In practice, you'll want to bind the HTTP::Response::Body to a local variable and call #readpartial on it repeatedly until it returns nil:

>> body = HTTP.get("https://github.com").body
=> #<HTTP::Response::Body:3ff756862b48 @streaming=false>
>> body.readpartial
=> "\n\n\n<!DOCTYPE html>\n<html lang=\"en\" class=\"\">\n  <head prefix=\"o..."
>> body.readpartial
=> "\" href=\"/apple-touch-icon-72x72.png\">\n    <link rel=\"apple-touch-ic..."
# ...
>> body.readpartial
=> nil

Supported Ruby Versions

This library aims to support and is tested against the following Ruby versions:

  • Ruby 2.6
  • Ruby 2.7
  • Ruby 3.0
  • JRuby 9.2

If something doesn't work on one of these versions, it's a bug.

This library may inadvertently work (or seem to work) on other Ruby versions, however support will only be provided for the versions listed above.

If you would like this library to support another Ruby version or implementation, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.

Contributing to http.rb

  • Fork http.rb on GitHub
  • Make your changes
  • Ensure all tests pass (bundle exec rake)
  • Send a pull request
  • If we like them we'll merge them
  • If we've accepted a patch, feel free to ask for commit access!

Copyright

Copyright © 2011-2021 Tony Arcieri, Alexey V. Zapparov, Erik Michaels-Ober, Zachary Anker. See LICENSE.txt for further details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].