Htty

htty is the HTTP TTY, a console application for interacting with web servers.
Alternatives To Htty
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Hoppscotch51,625120 hours ago1March 22, 2022137mitTypeScript
👽 Open source API development ecosystem - https://hoppscotch.io
Httpie27,8561,645423 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.
Postgrest20,585
42 days ago37July 12, 2022209mitHaskell
REST API for any Postgres database
Okhttp Okgo10,444
9 months ago461apache-2.0Java
OkGo - 3.0 震撼来袭,该库是基于 Http 协议,封装了 OkHttp 的网络请求框架,比 Retrofit 更简单易用,支持 RxJava,RxJava2,支持自定义缓存,支持批量断点下载管理和批量上传管理功能
Falcon9,05932 days ago4March 25, 2022162apache-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,9289,060286a month ago23May 12, 2021106iscErlang
Small, fast, modern HTTP server for Erlang/OTP.
Rest Assured6,3497,364395a month ago29September 09, 2022503apache-2.0Java
Java DSL for easy testing of REST services
Wiremock5,5601,62675211 hours ago104September 10, 2020323apache-2.0Java
A tool for mocking HTTP services
Rest Client5,17552,4724,2027 months ago65August 22, 2019146mitRuby
Simple HTTP and REST client for Ruby, inspired by microframework syntax for specifying actions.
Restful Api Design References4,823
a year ago2mit
RESTful API 设计参考文献列表,可帮助你更加彻底的了解REST风格的接口设计。
Alternatives To Htty
Select To Compare


Alternative Project Comparisons
Readme
                 s         s
  .uef^"        :8        :8      ..
:d88E          .88       .88     @L
`888E         :888ooo   :888ooo 9888i   .dL
 888E .z8k -*8888888 -*8888888 `Y888k:*888.
 888E~?888L  8888      8888      888E  888I
 888E  888E  8888      8888      888E  888I
 888E  888E  8888      8888      888E  888I
 888E  888E .8888Lu=  .8888Lu=   888E  888I
 888E  888E ^%888*    ^%888*    x888N><888'
m888N= 888>   'Y"       'Y"      "88"  888
 `Y"   888   __  .__                  88F
      J88" _/  |_|  |__   ____       98"
      @%   \   __\  |  \_/ __ \    ./"
    :"      |  | |   Y  \  ___/   ~`
            |__| |___|  /\___  >
            __________\/_____\/____________________
           /   |   \__    ___/\__    ___/\______   \
          /    ~    \|    |     |    |    |     ___/
          \    Y    /|    |     |    |    |    |
           \___|_  / |____|     |____|    |____|
           ______\/___________________.___.
           \__    ___/\__    ___/\__  |   |
             |    |     |    |    /   |   |
             |    |     |    |    \____   |
             |____|     |____|    / ______|
                                  \/

htty is a console application for interacting with web servers. Its a fun way to explore web APIs and to learn the ins and outs of HTTP.

Travis CI build status Code Climate quality report Code Climate coverage report

Gemnasium build status Inch CI build status RubyGems release

See whats changed lately by reading the project history.

Installation

It couldnt be much easier.

$ gem install htty

Youll need Ruby and RubyGems. Its known to work well under OS X against Ruby v1.8.7, v1.9.2, v1.9.3, v2.0, v2.1, and v2.2.

Features

  • Intuitive, Tab-completed commands and command aliases
  • Support for familiar HTTP methods GET, POST, PUT, and DELETE, as well as PATCH, HEAD, OPTIONS and TRACE
  • Support for HTTP Secure connections and HTTP Basic Authentication
  • Automatic URL-encoding of userinfo, paths, query-string parameters, and page fragments
  • Transcripts, both verbose and summary
  • Scripting via stdin
  • Dead-simple cookie handling and redirect following
  • Built-in help

The things you can do with htty are:

  • Build a request you can tweak the address, headers, cookies, and body at will
  • Send the request to the server after the request is sent, it remains unchanged in your session history
  • Inspect the servers response you can look at the status, headers, cookies, and body in various ways
  • Review history a normal and a verbose transcript of your session are available at all times (destroyed when you quit htty)
  • Reuse previous requests you can refer to prior requests and copy them

Examples

Here are a few annotated htty session transcripts to get you started (terminal screenshots shown here are also available in textual form).

Querying a web service

This simple example shows how to explore a read-only web service with htty.

ESV Bible Web Service example #1

You can point htty at a complete or partial web URL. If you dont supply a URL, http://0.0.0.0/ (port 80) will be used. You can vary the protocol scheme, userinfo, host, port, path, query string, and fragment as you wish.

The htty shell prompt shows the address of the current request.

The get command is one of seven HTTP request methods supported. A concise summary of the response is shown when you issue a request.

You can follow redirects using the follow command. No request is made until you type a request command such as get or post.

ESV Bible Web Service example #2

You can tweak segments of the address at will. Here we are navigating the sites path hierarchy, which you can do with relative as well as absolute pathspecs.

ESV Bible Web Service example #3

Here we add query-string parameters. Notice that characters that require URL encoding are automatically URL-encoded (unless they are part of a URL-encoded expression).

The headers-response and body-response commands reveal the details of a response.

ESV Bible Web Service example #4

There was some cruft in the web services response (a horizontal line, a passage reference, verse numbers, a copyright stamp, and line breaks). We eliminate it by using API options provided by the web service were talking to.

We do a Julia Child maneuver and use the address command to change the entire URL, rather than add individual query-string parameters one by one.

Exit your session at any time by typing quit or hitting Ctrl-D.

Working with cookies

The next example demonstrates httys HTTP Secure support and cookies features, as well as how to review and revisit past requests.

Google example #1

The https:// scheme and port 443 imply each other, just as the http:// scheme and port 80 imply each other. If you omit the scheme or the port, it will default to the appropriate value.

Notice that when cookies are offered in a response, a bold asterisk (it looks like a cookie) appears in the response summary. The same cookie symbol appears next to the Set-Cookie header when you display response headers.

Google example #2

The cookies-use command copies cookies out of the response into the next request. The cookie symbol appears next to the Cookie header when you display request headers.

Google example #3

An abbreviated history is available through the history command. Information about requests in the history includes request method, URL, number of headers (and a cookie symbol, if cookies were sent), and the size of the body. Information about responses in the history includes response code, number of headers (and a cookie symbol, if cookies were received), and the size of the body.

Note that history contains only numbered HTTP request and response pairs, not a record of all the commands you enter.

The reuse command makes a copy of the headers and body of an earlier request for you to build on.

Understanding complex HTTP conversations at a glance using history

Now well look at httys HTTP Basic Authentication support and learn how to display unabbreviated transcripts of htty sessions.

Assume that we have the following Sinatra application listening on Sinatras default port, 4567.

require 'sinatra'

get '/all-good' do
  [200, [['Set-Cookie', 'foo=bar; baz']], 'Hello World!']
end

put '/huh' do
  [404, 'What?']
end

delete '/hurl' do
  [500, 'Barf!']
end

post '/submit-novel' do
  redirect '/all-good'
end

This application expects GET and POST requests and responds in various contrived ways.

Sinatra application example #1

When you change the userinfo portion of the address, or the entire address, the appropriate HTTP Basic Authentication header is created for you automatically. Notice that characters that require URL encoding are automatically URL-encoded (unless they are part of a URL-encoded expression).

When userinfo is supplied in a request, a bold mercantile symbol ( @ ) appears next to the resulting Authorization header when you display request headers (see below).

Type body-set to enter body data, and terminate it by entering two consecutive blank lines, or by hitting Ctrl-D. The body will only be sent for POST and PUT requests. The appropriate Content-Length header is created for you automatically (see below).

Different response codes are rendered with colors that suggest their meaning:

  • Response codes between 200 and 299 appear black on green to indicate success
  • Response codes between 300 and 399 appear white on blue to indicate redirection
  • Response codes between 400 and 499 appear white on red to indicate failure
  • Response codes between 500 and 599 appear flashing black on yellow to indicate a server error

Sinatra application example #2

As with the abbreviated history demonstrated earlier, verbose history shows a numbered list of requests and the responses they elicited. All information exchanged between client and server is shown.

Getting help

You can learn how to use htty commands from within htty.

httys built-in help

The help command takes an optional argument of the abbreviated or full name of a command.

Contributing

Report defects and feature requests on GitHub Issues.

Your patches are welcome, and you will receive attribution here for good stuff. Fork the official htty repository and send a pull request.

Development

After cloning the repository, bin/setup to install dependencies. Then rake to run the tests. You can also bin/console to get an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, bundle exec rake install. To release a new version, update the version number in lib/htty/version.rb, and then bundle exec rake release, which will create a Git tag for the version, push Git commits and tags, and push the .gem file to RubyGems.org.

News and information

Stay in touch with the htty project by following @get_htty on Twitter.

You can also get help in the #htty channel on Freenode.

Credits

The author, Nils Jonsson, owes a debt of inspiration to the http-console project.

Thanks to contributors (in alphabetical order):

License

Released under the MIT License.

Popular Http Projects
Popular Rest Projects
Popular Networking Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Ruby
Http
Rest
Cookies
Cookie
Developer Tools
Command Line App