sport195/rendr — pull request #2 by saiwong (2013-06-25 18:59:51+00:00)
Title: Added access of response object to `DataAdapter`

Added access of response object to `DataAdapter` so that extra info such as headers
or cookies can be set on the response by the `DataAdapter`.

Proxying cookies to/from the browser to the API endpoint.

```javascript
DataAdapter.prototype.request = function(req, api, options, callback, res) {
...
// add request's cookies to api call
cookies = request.jar();
_.each( req.headers.cookie.split( ';' ), function( cookie ) {
cookies.add( request.cookie( cookie ) );
});
_.extend( api, { jar: cookies });

request(api, function(err, response, body) {
...
// append the api' response headers to the response of this call
if ( res && response.headers['set-cookie'] ) {
res.setHeader('Set-Cookie', response.headers['set-cookie'] );
}
callback(err, response, body);
});
})
```