Nap is a really simple REST library.
Alternatives To Nap
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Hoppscotch51,75216 hours ago1March 22, 2022146mitTypeScript
👽 Open source API development ecosystem -
Httpie27,8561,6454212 days ago55May 06, 2022146bsd-3-clausePython
🥧 HTTPie for Terminal — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
43 days ago37July 12, 2022207mitHaskell
REST API for any Postgres database
Okhttp Okgo10,444
9 months ago461apache-2.0Java
OkGo - 3.0 震撼来袭,该库是基于 Http 协议,封装了 OkHttp 的网络请求框架,比 Retrofit 更简单易用,支持 RxJava,RxJava2,支持自定义缓存,支持批量断点下载管理和批量上传管理功能
Falcon9,1133a day ago4March 25, 2022155apache-2.0Python
The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
Cowboy6,9569,060286a month ago23May 12, 2021106iscErlang
Small, fast, modern HTTP server for Erlang/OTP.
Rest Assured6,3497,3643952 months ago29September 09, 2022503apache-2.0Java
Java DSL for easy testing of REST services
Wiremock5,5801,62675216 hours ago104September 10, 2020313apache-2.0Java
A tool for mocking HTTP services
Rest Client5,17552,4724,2028 months ago65August 22, 2019146mitRuby
Simple HTTP and REST client for Ruby, inspired by microframework syntax for specifying actions.
Restful Api Design References4,823
2 years ago2mit
RESTful API 设计参考文献列表,可帮助你更加彻底的了解REST风格的接口设计。
Alternatives To Nap
Select To Compare

Alternative Project Comparisons


Nap is an extremely simple REST client for Ruby. It was built to quickly fire off HTTP requests without having to research net/http internals.


gem 'nap'
require 'rest'
require 'json'

response = REST.get('', {},
  {:username => '_evan', :password => 'buttonscat'}
if response.ok?
  timeline = JSON.parse(response.body)
  puts( do |item|
elsif response.forbidden?
  puts "Are you sure you're `_evan' and your password is the name of your cat?"
  puts "Something went wrong (#{response.status_code})"
  puts response.body

Advanced request configuration

If you need more control over the Net::HTTP request you can pass a block to all of the request methods.

response = REST.get('') do |http_request|
  http_request.open_timeout = 15

Proxy support

To enable the proxy settings in Nap, you can either use the HTTP_PROXY or http_proxy enviroment variable.

$ env HTTP_PROXY=http://rob:[email protected]:665 ruby app.rb


Nap defines one top-level and three main error types which allow you to catch a whole range of exceptions thrown by underlying protocol implementations.

  • REST::Error: Any type of error
  • REST::Error::Timeout: Read timeouts of various sorts
  • REST::Error::Connection: Connection errors caused by dropped sockets
  • REST::Error::Protocol: Request failed because of a problem when handling the HTTP request or response

In the most basic case you can rescue from the top-level type to warn about fetching problems.

rescue REST::Error
  puts "[!] Failed to fetch Pigeon number 12."


Nap couldn't be the shining beacon in the eternal darkness without help from:

  • Eloy Durán
  • Joshua Sierles
  • Thijs van der Vossen

For all other great human beings, please visit the GitHub contributors page.

Changes from 1.0.0 to 1.1.0

  • REST::Request now allows all HTTP verbs to send a body entity.

Changes from 0.8.0 to 1.0.0

  • Removed REST::DisconnectedError, please use REST::Error::Connection instead.
Popular Rest Projects
Popular Http Projects
Popular Application Programming Interfaces Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Http Requests