Reading and modifying the response after the route?

8 views
Skip to first unread message

milan

unread,
Aug 23, 2012, 3:07:53 PM8/23/12
to flati...@googlegroups.com
I have the following method that is configured to be called after the route executes.  I have verified that this is executing in proper order.

What I'm looking to do now is get my hands on the object that was attached to the response while the route was processing.  However, I don't know which property to access.  I need to be able to see the object and remove properties for security reasons in case the route exposed too much data.  I'm using this.res.json(myObject); to attach the object to the response.

function dataSecurity() {
    var union = require('union');
    var stream = new union.ResponseStream();

    stream.once("data", function () {
        console.log('Data Security');

        console.log({ res: this.res.statusCode, method: this.req.method, response: this.res });
    });

    return stream;
}

Reply all
Reply to author
Forward
0 new messages