gruntjs/grunt-contrib-livereload — pull request #43 by appleYaks (2013-05-03 19:06:04+00:00)
Title: res.write not called, empty returned response

I confess I really have no idea what I'm doing, but when I try to use the livereloadSnippet middleware in my grunt-express app [as here](https://github.com/blai/grunt-express-example/blob/master/app/server.js#L22), I get an empty response on my routes.

Looking at the code, one comment says, before overwriting `res.write`:

```javascript
// Bypass write until end
var inject = res.write = function (string, encoding) {
```

But the call to the original res.write doesn't seem to take place. If I cache the value and include it before a call to the original res.end, I get the response I'm looking for - the livereload snippet included at the end of the body.

### Tests

I tried to run the tests with `grunt`, but got:
```
Running "simplemocha:all" (simplemocha) task
Warning: Arguments to path.resolve must be strings Use --force to continue.

Aborted due to warnings.
```

So I used `grunt --force`, and got:
```
Running "simplemocha:all" (simplemocha) task
Warning: Arguments to path.resolve must be strings Used --force, continuing.

Running "build-contrib" task
>> Created README.md
>> Created CONTRIBUTING.md

Done, but with warnings.
```

I'm aware there should be a test to check if the original write function is called, but I'm not so sure the tests are executing properly. If I add an `assert.ok(false);` to the end of `it('should re-write response write function'`, I get the same result as above with `grunt --force`.