strongloop/loopback-testing — pull request #17 by zackbloom (2014-06-10 08:32:23+00:00)
Title: Add the ability to intercept requests before they actually get sent

I needed to add a body to requests. LMK if there is an existing way to do it, this is what I came up with. The last argument to `whenCalledRemotely`, and therefore all the functions which wrap it, can now be an object with `callback` and `beforeRequest` options.

Usage becomes:

```coffeescript
lt.describe.whenCalledByUser USER, 'PUT', '/apps',
beforeRequest: ->
@http.send({orgId: 5})
callback: ->
lt.it.shouldBeDenied()
```