Wynn Netherland changelog.com/posts

webshell: A console-based JavaScripty web client utility (using node.js)

If you’re like me, you probably spend a good deal of time using cURL from the console or Hurl on the web to test/inspect/debug HTTP stuffs. Wanting something a bit more robust and console-friendly Evan Haas and Sean Coates have created Webshell.

Webshell is built on Node.js (of which we’re big fans), and gives you a simple console to load and debug HTTP calls, follow 302 redirects, store history, process JSON, and more:

To run, clone the project and then fire up the shell with Node:

node shell.js 

Then you’re all set to start making HTTP requests:

webshell> GET http://google.com/
HTTP 301 http://google.com/
webshell> $_.headers
{ location: 'http://www.google.com/'
, 'content-type': 'text/html; charset=UTF-8'
, date: 'Sun, 08 Aug 2010 22:38:23 GMT'
, expires: 'Tue, 07 Sep 2010 22:38:23 GMT'
, 'cache-control': 'public, max-age=2592000'
, server: 'gws'
, 'content-length': '219'
, 'x-xss-protection': '1; mode=block'
, connection: 'close'
webshell> $_.headers.location
webshell> $_.follow()
HTTP 302 http://www.google.com/
webshell> $_.headers.location
webshell> $_.follow()
HTTP 200 http://www.google.ca/
webshell> $_.raw.substring(0, 50)
'<!doctype html><html><head><meta http-equiv="conte'
webshell> ^D

The built-in JSON processing is slick:

webshell> GET http://twitter.com/users/coates.json
HTTP 200 http://twitter.com/users/coates.json
webshell> $_.json.name
'Sean Coates'
webshell> ^D

[Source on GitHub]


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00