cloudhead / http-console Goto Github PK
View Code? Open in Web Editor NEWsimple, intuitive HTTP REPL — Speak HTTP like a local.
License: Apache License 2.0
simple, intuitive HTTP REPL — Speak HTTP like a local.
License: Apache License 2.0
I'm getting a random error when doing multiple requests that result in non-json responses. There's no clear way to replicate it, but it looks like if I do several POST connections in a row with different POST data I'll get the error on 5th or 6th request:
http://www.google.ru:80/> POST ... HTTP/1.1 405 Method Not Allowed Allow: GET, HEAD Date: Sat, 12 Jun 2010 10:43:14 GMT Content-Type: text/html; charset=UTF-8 Server: gws Content-Length: 1391 X-Xss-Protection: 1; mode=block Connection: close ReferenceError: sys is not defined at [object Object].printResponse (/home/eugene/.node_libraries/.npm/http-console/0.3.0/package/lib/http-console.js:192:21) at /home/eugene/.node_libraries/.npm/http-console/0.3.0/package/lib/http-console.js:159:40 at IncomingMessage. (/home/eugene/.node_libraries/.npm/http-console/0.3.0/package/lib/http-console.js:97:56) at IncomingMessage.emit (events:42:20) at HTTPParser.onMessageComplete (http:110:23) at Client.ondata (http:861:22) at IOWatcher.callback (net:502:31) at node.js:221:9
I've tried making the following change: eugenebolshakov/http-console@cb69a46ff5e23fe845bb34934b15156e8bdc89ae and it looks like the error doesn't occur anymore. However I can't really explain the reason :)
Databases like _users
, blah
, a123
are fine. But I have dbs that named like one/two
, which is permitted in CouchDB. From node I request them with slash encoded as %2F
- one%2Ftwo/document
. With http-console, I can't access those dbs - I just get 404.
This happened with most latest release, running on OSX 10.6, node v. 0.2.6
"unknown command" returned for .q and .header. Thus .q didn't quit.
Also, is it possible to send data with a GET request?
...either through a special \auth command, or by properly parsing URLs of the form username:password@hostname (currently everything after ":" is interpreted as a port number).
When http-console
tries to store a cookie, this happens:
TypeError: Object myCoolWebApp_session=4d03fceabee6760485000002; HttpOnly has no method 'split'
at [object Object].rememberCookies (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:267:44)
at ClientRequest.<anonymous> (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:115:54)
at ClientRequest.emit (events.js:27:15)
at HTTPParser.onIncoming (http.js:987:9)
at HTTPParser.onHeadersComplete (http.js:88:31)
at Client.onData [as ondata] (http.js:880:27)
at Client._onReadable (net.js:566:27)
at IOWatcher.onReadable [as callback] (net.js:151:10)
It looks like whatever is in the headers
array here is not a proper string.
so i'm not sure if this is an issue or not....
suppose im working on a web app, here is my workflow....
is that expected? do you see the workflow issue here?
thanks cloudhead! you rock!
Running npm install http-console
I get:
npm install pkg eyes@>=0.1.4
npm fetch data eyes
npm GET eyes
npm install pkg eyes@>=0.1.4
npm ! Error: Tag >=0.1.4 not found for package eyes
I've tried install eyes manually with npm install eyes
but I get the same error.
Thanks for the awesome tool! It's very helpful in debugging REST services.
How exactly do I send over a + sign?
I tried:
GET ?email=[email protected]
Result: the + doesn't get encoded, is interpreted as a space (as expected)
But also:
GET ?email=user%[email protected]
Result: the % gets URL encoded resulting in user%[email protected] which is treated as the literal 'user%[email protected]'
Http-console should add a Content-Length header to all requests with a body. Some web servers (e.g. Nginx) refuse to respond to requests without it. Having to add it manually defeats the whole purpose of this tool.
There should be a way to either disable chunked output, or get the next chunk. If there is, my apologies, how do you do it?
I have a local site on passenger at an address: http://cblitz.local. Curl can load it, but http-console does this:
http://cblitz.local:80> GET
Error: ENOTFOUND, Domain name not found
I would appreciate a way to switch the server without restarting.
Just started with it (npm installer), but got this error (also with source version from github):
[ arunjitsingh ] ~ ◊: 54$ http-console 127.0.0.1:5984 > http-console 0.5.1 > Welcome, enter \help if you're lost. > Connecting to 127.0.0.1 on port 5984. http://127.0.0.1:5984/> GET / Error: Stream already opened at Client.connect (net.js:630:22) at Client._ensureConnection (http.js:1040:10) at Client.request (http.js:1055:8) at [object Object].request (/Users/arunjitsingh/.node_libraries/.npm/http-console/0.5.1/package/lib/http-console.js:110:31) at [object Object].exec (/Users/arunjitsingh/.node_libraries/.npm/http-console/0.5.1/package/lib/http-console.js:191:22) at Interface. (/Users/arunjitsingh/.node_libraries/.npm/http-console/0.5.1/package/lib/http-console.js:60:18) at Interface.emit (events.js:31:17) at Interface._onLine (readline.js:123:10) at Interface._ttyWrite (readline.js:335:12) at Interface.write (readline.js:173:30) http://127.0.0.1:5984/> Error: assertion error at node.js:35:19 at IOWatcher.onWritable [as callback] (net.js:164:18) http://127.0.0.1:5984/> Error: assertion error
That last repeats in an endless loop..
(Using the bleeding-edge version of node: v0.3.4-pre)
Same thing happens with PUT, POST and DELETE requests
cURL'ing works:
[ arunjitsingh ] ~ ◊: 58$ curl http://127.0.0.1:5984 {"couchdb":"Welcome","version":"1.0.1"}
Thoughts/ideas?
Browsing the code I was able to figure out that in order to send multiple datums for POST I had to use a syntax like
x=1&y=2
rather than something like
{"x":1,"y":2}
The latter would be cool, but seems to not be supported at the moment. The former is fine but the documentation should be changed to reflect it.
Seems like some dependency is missing.
$ node -v
v0.1.97
$ npm install http-console
$ http-console 127.0.0.1:80
module:238
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module 'ext'
at loadModule (module:238:15)
at require (module:364:12)
at Object.<anonymous> (/Users/felix/.node_libraries/.npm/http-console/0.2.0/package/lib/http-console.js:7:1)
at Module._compile (module:384:23)
at Module._loadScriptSync (module:393:16)
at Module.loadSync (module:296:10)
at loadModule (module:241:16)
at require (module:364:12)
at Object.<anonymous> (/Users/felix/.node_libraries/http-console.js:4:18)
at Module._compile (module:384:23)
Node version: 0.3.2
Command Line: http-console localhost 8000 ( or http-console 127.0.0.1 )
http://localhost:8000> GET /
fails with an infinite loop on the following assertion error:
Error: assertion error
at node.js:35:19
at IOWatcher.onWritable [as callback] (net.js:164:5)
net.js:164:5 is an assertion:
assert(socket.writable);
what my output is too larget, the http-console trim() it to a certain size.
how to output the full output?
It looks like POST and PUT requests stopped working after readline support has been added. When I try to enter data it just echoes my input and doesn't perform the request:
$ http-console google.com > http-console 0.3.0 > Welcome, enter \help if you're lost. > Connecting to google.com on port 80. http://google.com:80/> POST ... whatever whatever
Changing dataPrompt to use readline seem to fix the issue:
eugenebolshakov/http-console@c263c7c989e83a1ff3c5cbd5852f16b32f435256
Is it blasphemy to ask why it's on npm vs. kiwi? Or why not both? I'm new to node, so I can't say which one is more popular or useful, but I do know that other packages I want to use with node (such as express) are already on there and I'd hate to have 2 package managers...
At any rate, just thought you'd give kiwi some consideration...
I am trying to use your product but here is the output...
jackie@jackie-Latitude-E6410:/usr/local/lib/node_modules/http-console/bin$ node -v
v0.7.7-pre
jackie@jackie-Latitude-E6410:/usr/local/lib/node_modules/http-console/bin$ ./http-console
node.js:242
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function. (module.js:381:11)
at Object. (/usr/local/lib/node_modules/http-console/bin/http-console:6:8)
at Module._compile (module.js:444:26)
at Object..js (module.js:462:10)
at Module.load (module.js:351:32)
at Function._load (module.js:309:12)
at Array.0 (module.js:482:10)
at EventEmitter._tickCallback (node.js:233:41)
jackie@jackie-Latitude-E6410:/usr/local/lib/node_modules/http-console/bin$ echo $NODE_PATH
/usr/local/lib/node
per http spec, these methods are standard - http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
There also seems to be a stray reference to an old Node.js module (require('sys')) on line 8 of 'http-console.js' file.
As for the bug itself? I install the module with npm, and enter the following into the command line:
node http-console localhost
Nothing is returned to the CLI.
I only find a blank cursor in reply.
Thought there be more interest in this project.
Given the state of cURL and Wget, it's quite, quite awsome...
patrick@Patrick-Quinn-Grahams-iMac:/Users/patrick$ http-console-0.3.3 localhost:80
module:238
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module 'http-console'
at loadModule (module:238:15)
at require (module:364:12)
at Object. (/usr/local/bin/http-console-0.3.3:8:19)
at Module._compile (module:381:21)
at Module._loadScriptSync (module:390:8)
at Module.loadSync (module:296:10)
at Object.runMain (module:444:22)
at node.js:253:10
Is there a way to pass URL parameters like ?key=value ?
How do I send a (json) file?
This makes the output less informative because of the use console.log() instead
messages.
When I use http-console with node 0.12 the console is scammed with messages:
util.puts: Use console.log instead
the username is parsed into options.auth.username. but the Authorization header is constructed as options.auth.user + ...
simple on line patch:
https://gist.github.com/726914
Hi,
$ uname -a3/RELEASE_I386 i386 i386 Macmini3,1 Darwin
Darwin kunstderfuge.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26
~$ brew --version
0.8
~$ node --version
v0.4.2
~$ npm --version
0.3.15
~$ npm ls installed
[email protected] [...]
[email protected] [...]
[email protected] [...]
[email protected] [...]
npm ok
~$ http-console 127.0.0.1:8080
http-console 0.5.1
Welcome, enter \help if you're lost.
Connecting to 127.0.0.1 on port 8080.
TypeError: Object true has no method 'write'
at Interface.prompt (readline.js:103:17)
at [object Object].prompt (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:247:23)
at [object Object].initialize (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:71:14)
at Object. (/usr/local/lib/node/.npm/http-console/0.5.1/package/bin/http-console:89:9)
at Module._compile (module.js:383:26)
at Object..js (module.js:389:10)
at Module.load (module.js:315:31)
at Function._load (module.js:276:12)
at Array. (module.js:402:10)
at EventEmitter._tickCallback (node.js:108:26)
\help
\headers show active request headers.
\options show options.
\cookies show client cookies.
\json set 'Content-Type' header to 'application/json'.
\help display this message.
\exit exit console.
\q
TypeError: Object true has no method 'write'
at Interface.prompt (readline.js:103:17)
at [object Object].prompt (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:247:23)
at [object Object].exec (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:201:14)
at Interface. (/usr/local/lib/node/.npm/http-console/0.5.1/package/lib/http-console.js:60:18)
at Interface.emit (events.js:42:17)
at Interface._onLine (readline.js:132:10)
at Interface._normalWrite (readline.js:206:10)
at ReadStream. (readline.js:45:12)
at ReadStream.emit (events.js:59:20)
at ReadStream._onReadable (net.js:649:14)
Thanks
http-console fails with:
module:238
throw new Error("Cannot find module '" + request + "'");
0 ^
Error: Cannot find module 'readline'
at loadModule (module:238:15)
at require (module:364:12)
at Object. (/home/badboy/code/http-console/lib/http-console.js:6:16)
at Module._compile (module:384:23)
at Module._loadScriptSync (module:393:16)
at Module.loadSync (module:296:10)
at loadModule (module:241:16)
at require (module:364:12)
at Object. (/home/badboy/code/http-console/bin/http-console:8:19)
at Module._compile (module:384:23)
where do I get readline?
Greetings,
It appears as if the background color of the response body (light gray) was chosen specifically for a console with a black background. I'm not opposed to switching the background of my console from white to black, but it seems a bit forceful for a single app to drive a system-level user preference.
Are the colors for HTTP Console configurable? If not, could you point me to a place in the code where I can change the hard-coded colors so that I can fork the code and make the change?
Thanks!
Scott
Hi,
Maybe it would be useful to explain a little bit what are the dependencies, what http-console is built on and how to install it besides launching npm install http-console
.
Thanks
In Mountain Lion, when I run 'npm install http-console' it installs to a local folder and not in /usr/local
I see digest auth is supported.
It would be nice if Www-Authenticate: ...
in response was detected and user/pass could be input.
Is "parselmouth" a previous name for lib/http-console.js?
module:238
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module 'parselmouth'
at loadModule (module:238:15)
at require (module:364:12)
at Object.<anonymous> (/Users/eager/.nvm/v0.1.96/bin/http-console:7:19)
at Module._compile (module:384:23)
at Module._loadScriptSync (module:393:16)
at Module.loadSync (module:296:10)
at Object.runMain (module:459:22)
at node.js:196:8
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.