Speak HTTP like a local. (the simple, intuitive HTTP console, golang version)

Overview

http-gonsole

This is the Go port of the http-console.

Speak HTTP like a local

Talking to an HTTP server with curl can be fun, but most of the time it's a PITA.

http-gonsole is a simple and intuitive interface for speaking the HTTP protocol.

PS: HTTP has never been this much fun.

Prerequisite

You'll need the to install go, http-gonsole is tested with release.r57.1.

How to use

Let's assume we have a CouchDB instance running locally.

connecting

To connect, we run http-gonsole, passing it the server host and port as such:

$ http-gonsole 127.0.0.1:5984 

navigating

Once connected, we should see the http prompt:

http://127.0.0.1:5984/>

server navigation is similar to directory navigation, except a little simpler:

http://127.0.0.1:5984/> /logs
http://127.0.0.1:5984/logs> /46
http://127.0.0.1:5984/logs/46> ..
http://127.0.0.1:5984/logs> ..
http://127.0.0.1:5984/>

requesting

HTTP requests are issued with the HTTP verbs GET, PUT, POST, HEAD and DELETE, and a relative path:

http://127.0.0.1:5984/> GET /
HTTP/1.1 200 OK
Date: Mon, 31 May 2010 04:43:39 GMT
Content-Length: 41

{
    couchdb: "Welcome",
    version: "0.11.0"
}

http://127.0.0.1:5984/> GET /bob
HTTP/1.1 404 Not Found
Date: Mon, 31 May 2010 04:45:32 GMT
Content-Length: 44

{
    error: "not_found",
    reason: "no_db_file"
}

When issuing POST and PUT commands, we have the opportunity to send data too:

http://127.0.0.1:5984/> /rabbits
http://127.0.0.1:5984/rabbits> POST
... {"name":"Roger"}

HTTP/1.1 201 Created
Location: http://127.0.0.1/rabbits/2fd9db055885e6982462a10e54003127
Date: Mon, 31 May 2010 05:09:15 GMT
Content-Length: 95

{
    ok: true,
    id: "2fd9db055885e6982462a10e54003127",
    rev: "1-0c3db91854f26486d1c3922f1a651d86"
}

Make sure you have your Content-Type header set properly, if the API requires it. More in the section below.

Note that if you're trying to POST to a form handler, you'll most probably want to send data in multipart/form-data format, such as name=roger&hair=black. http-gonsole sends your POST/PUT data as is, so make sure you've got the format right, and the appropriate Content-Type header.

setting headers

Sometimes, it's useful to set HTTP headers:

http://127.0.0.1:5984/> Accept: application/json
http://127.0.0.1:5984/> X-Lodge: black

These headers are sent with all requests in this session. To see all active headers, run the \headers or \h command:

http://127.0.0.1:5984/> \headers
Accept: application/json
X-Lodge: black

Removing headers is just as easy:

http://127.0.0.1:5984/> Accept:
http://127.0.0.1:5984/> \h
X-Lodge: black

cookies

You can enable cookie tracking with the --cookies option flag. To see what cookies are stored, use the \cookies or \c command.

SSL

To enable SSL, pass the --ssl flag, or specify the address with https.

quitting

http://127.0.0.1:5984/> \q

or,

http://127.0.0.1:5984/> ^D

nuff' said.

License

BSD License

Issues
  • Go readline

    Go readline

    What about go-readline? I tried to follow your instructions, but they seem to be outdated.

    Maybe it's possible to use this project https://github.com/sbinet/go-readline to enable of arrows usage and emacs/vim bindings while putting value.

    Also would be cool if arrow up/down would navigate through history

    opened by romanoff 5
Owner
mattn
Long-time Golang user&contributor, Google Dev Expert for Go, and author of many Go tools, Vim plugin author. Windows hacker C#/Java/C/C++
mattn
Http-conection - A simple example of how to establish a HTTP connection using Golang

A simple example of how to establish a HTTP connection using Golang

Jonathan Gonzaga 0 Feb 1, 2022
Simple HTTP package that wraps net/http

Simple HTTP package that wraps net/http

Kris 0 Jan 17, 2022
Http client call for golang http api calls

httpclient-call-go This library is used to make http calls to different API services Install Package go get

pzenteno 14 Mar 8, 2022
fhttp is a fork of net/http that provides an array of features pertaining to the fingerprint of the golang http client.

fhttp The f stands for flex. fhttp is a fork of net/http that provides an array of features pertaining to the fingerprint of the golang http client. T

Flexagon 61 Jun 10, 2022
NATS HTTP Round Tripper - This is a Golang http.RoundTripper that uses NATS as a transport.

This is a Golang http.RoundTripper that uses NATS as a transport. Included is a http.RoundTripper for clients, a server that uses normal HTTP Handlers and any existing http handler mux and a Caddy Server transport.

R.I.Pienaar 75 Jun 14, 2022
This is repository for Simple HTTP GET golang app that counts standard deviation from random.org integers

Simple Get Deviation App This is repository for Simple HTTP GET golang app that counts standard deviation from random.org integers IMPORTANT: Because

null 0 Jan 10, 2022
Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttp Fast HTTP implementation for Go. Currently fasthttp is successfully used by VertaMedia in a production serving up to 200K rps from more than

Aliaksandr Valialkin 17.9k Jun 26, 2022
Simple HTTP and REST client library for Go

Resty Simple HTTP and REST client library for Go (inspired by Ruby rest-client) Features section describes in detail about Resty capabilities Resty Co

Go Resty 6.3k Jun 26, 2022
Simple web-hook based receiver executing things via HTTP request

Updater is a simple web-hook-based receiver executing things via HTTP requests and invoking remote updates without exposing any sensitive info, like ssh keys, passwords, etc.

Umputun 36 May 21, 2022
a simple wrapper around resty to report HTTP calls metrics to prometheus

restyprom a simple wrapper around resty to report HTTP calls metrics to prometheus If you're using resty and want to have metrics of your HTTP calls,

Felipe Volpone 1 Mar 16, 2022
Simple http client

www Simple http client for golang with user-friendly interface. Features Chainable API Direct file upload Timeout Cookie GZIP Charset detection Cleane

null 4 Nov 15, 2021
tasq is a simple HTTP-based task queue. Each task is represented as a string

tasq tasq is a simple HTTP-based task queue. Each task is represented as a string (it could be anything). Tasks are pushed to the queue via an HTTP en

Alex Nichol 5 May 26, 2022
This is a simple single-host reverse proxy that intercept and save HTTP requests and responses

HTTP Telescope Debug HTTP requests using a reverse proxy. Description This is a simple single-host reverse proxy that intercept and save HTTP requests

Enrico 3 Mar 20, 2022
An enhanced http client for Golang

go-http-client An enhanced http client for Golang Documentation on go.dev ?? This package provides you a http client package for your http requests. Y

Furkan Bozdag 40 May 23, 2022
Go (golang) http calls with retries and backoff

pester pester wraps Go's standard lib http client to provide several options to increase resiliency in your request. If you experience poor network co

Seth Ammons 590 Jun 20, 2022
http client for golang

Request HTTP client for golang, Inspired by Javascript-axios Python-request. If you have experience about axios or requests, you will love it. No 3rd

Monaco.HappyHacking 206 Jun 24, 2022
A nicer interface for golang stdlib HTTP client

rq A nicer interface for golang stdlib HTTP client Documents rq: here client: here jar: here Why? Because golang HTTP client is a pain in the a... Fea

Ddo 40 Jan 23, 2022
HTTP mocking for Golang

httpmock Easy mocking of http responses from external resources. Install Currently supports Go 1.7 - 1.15. v1 branch has to be used instead of master.

Jared Morse 1.4k Jun 29, 2022
A fantastic HTTP request libarary used in Golang.

goz A fantastic HTTP request library used in golang. Inspired by guzzle Installation go get -u github.com/idoubi/goz Documentation API documentation

艾逗笔 225 Jun 21, 2022