{"issue":{"created_at":"2011-11-21T19:01:39Z","state":"closed","updated_at":"2011-11-23T01:52:13Z","user":{"gravatar_id":"8b1cdadd1804a128dced3531b89efc1d","id":57536,"url":"https://api.github.com/users/jesusabdullah","login":"jesusabdullah","avatar_url":"https://secure.gravatar.com/avatar/8b1cdadd1804a128dced3531b89efc1d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":2,"body":"So, I've been trying to get a static middleware for union (and express) running, and I got a bunch of nice features implemented by @substack but getting it to work with union is being painful.\r\n\r\nRunning the example with the gh-4 branch (which tries to implement getHeader & friends) and trying to get `/hello.txt` gets you this:\r\n\r\n```bash\r\njosh@onix:~/dev/ecstatic$ node example/union.js \r\nListening on :8080\r\n\r\n/home/josh/dev/union/lib/http-stream.js:40\r\n    this.query = ~source.url.indexOf('?')\r\n                             ^\r\nTypeError: Cannot call method 'indexOf' of undefined\r\n    at [object Object].pipeState (/home/josh/dev/union/lib/http-stream.js:40:30)\r\n    at [object Object].emit (events.js:81:20)\r\n    at [object Object].pipe (stream.js:159:8)\r\n    at /home/josh/dev/ecstatic/ecstatic.js:52:11\r\n[1]+  Done                    gedit ecstatic.js\r\njosh@onix:~/dev/ecstatic$ \r\n```\r\nSo, source.url is missing. Okay, I can circumvent this. But, when I do, it seems the problem's deeper:\r\n\r\n```bash\r\njosh@onix:~/dev/ecstatic$ node example/union.js \r\nListening on :8080\r\nCannot call method 'indexOf' of undefined\r\n\r\nevents.js:143\r\n    listener.apply(this, arguments);\r\n             ^\r\nTypeError: Cannot call method 'apply' of undefined\r\n    at [object Object].g (events.js:143:14)\r\n    at [object Object].emit (events.js:81:20)\r\n    at [object Object].pipe (stream.js:159:8)\r\n    at /home/josh/dev/ecstatic/ecstatic.js:52:11\r\njosh@onix:~/dev/ecstatic$ \r\n```\r\n\r\nThis is what ecstatic is doing with the response around that time:\r\n\r\n```js\r\n        res.setHeader('content-type', mime.lookup(file));\r\n        var s = fs.createReadStream(file);\r\n        s.pipe(res);\r\n        s.on('error', function (err) {\r\n          res.statusCode = 500;\r\n          if (res.writable) res.end(err && err.stack || err.toString());\r\n        });\r\n```\r\n\r\nand the error seems to occur on s.pipe(res).\r\n\r\nI'd fix this myself but I'm not really sure where to look.","assignee":{"gravatar_id":"d43e8ea63b61e7669ded5b9d3c2e980f","id":4624,"url":"https://api.github.com/users/indexzero","login":"indexzero","avatar_url":"https://secure.gravatar.com/avatar/d43e8ea63b61e7669ded5b9d3c2e980f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"id":2308079,"labels":[{"name":"high-priority","color":"e10c02","url":"https://api.github.com/repos/flatiron/union/labels/high-priority"}],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":8,"title":"Odd issues with response stream missing a bunch of stuff","closed_at":"2011-11-23T01:52:13Z","html_url":"https://github.com/flatiron/union/issues/8","url":"https://api.github.com/repos/flatiron/union/issues/8","milestone":null},"action":"created","comment":{"created_at":"2011-11-23T01:52:13Z","updated_at":"2011-11-23T01:52:13Z","user":{"gravatar_id":"d43e8ea63b61e7669ded5b9d3c2e980f","id":4624,"url":"https://api.github.com/users/indexzero","login":"indexzero","avatar_url":"https://secure.gravatar.com/avatar/d43e8ea63b61e7669ded5b9d3c2e980f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"This is a duplicate of #4. Investigating that issue.","id":2843948,"url":"https://api.github.com/repos/flatiron/union/issues/comments/2843948"}}