Fix cli interface for Node 0.10 #86

wants to merge 2 commits into


None yet

5 participants

edpaget commented Mar 14, 2013

I will also update tests and docs (one test is failing at the moment, that I'm trying to trouble shoot), but it's a one line change to add request.resume() to the cli server. Mostly I wanted to get this up, so people who upgrade to 0.10 don't need to be confused about why the static command stopped working like I was.

deiga commented Mar 14, 2013

👍 for this one. Had me stumped for a while

phstc commented Mar 14, 2013


I tested and the tests npm test seems to be passing fine. Which test is failing for you?

Is request.resume() obligatory in Node 0.10?

Resumes a paused request/response.

I didn't get it.

deiga commented Mar 15, 2013

I had the problem of node-static not running an endless loop in my browser, adding request.resume() fixed this. So yeah, it seems obligatory


Awesome, thanks, ran in to this one as well as I first tried this on 0.10!

edpaget commented Mar 15, 2013

@phstc this test fails for me on OS X 10.7.

streaming a 404 page
    ✗ should respond with 404
      TypeError: Cannot read property 'statusCode' of undefined
      at Request.suite.addBatch.addBatch.streaming a 404 page.should respond with 404 (/Users/edpaget/Documents/node-static/test/integration/node-static-test.js:50:30)
      at runTest (/Users/edpaget/Documents/node-static/node_modules/vows/lib/vows.js:132:26)
      at EventEmitter.<anonymous> (/Users/edpaget/Documents/node-static/node_modules/vows/lib/vows.js:85:17)
      at EventEmitter.emit (events.js:117:20)
      at EventEmitter.options.Emitter.emit (/Users/edpaget/Documents/node-static/node_modules/vows/lib/vows.js:237:24)
      at that.emitter.ctx (/Users/edpaget/Documents/node-static/node_modules/vows/lib/vows/context.js:31:52)
      at Request.env.callback [as _callback] (/Users/edpaget/Documents/node-static/node_modules/vows/lib/vows/context.js:46:29)
      at self.callback (/Users/edpaget/Documents/node-static/node_modules/request/index.js:142:22)
      at Request.EventEmitter.emit (events.js:95:17)
      at Request.options.Emitter.emit (/Users/edpaget/Documents/node-static/node_modules/vows/lib/vows.js:237:24)
    ✗ should respond with the streamed content
        » expected 'Custom 404 Stream.',
        got      undefined (==) // node-static-test.js:54
edpaget commented Mar 15, 2013

@phstc request.resume() isn't obligatory in Node 0.10. The new Streams2 api pauses streams if there isn't a listener for a 'data' event. Since the static command only listens for an 'end' event on the http stream, node pauses the stream and the end event is never triggered. request.resume() just tells it to let the stream continue anyway.

phstc commented Mar 19, 2013

Hi @edpaget, thanks for the explanation. 😄

I updated my Node to v0.10.0 and got you PR, for me the testing is freezing on should be listening.

once an http server is listening with a callback
✓ should be listening

Is it working for you?

edpaget commented Mar 19, 2013

@phstc It hangs there for a while, but then continues on my machine. I'm a little lost on how things are working on Vows (I've only used Jasmine and Mocha), so I haven't figured out why it sits forever on that test.

@phstc phstc closed this May 25, 2013
@edpaget edpaget deleted the edpaget:node-0.10 branch Aug 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment