Ensure there is a response before redirect check

I had some bad settings, and instead of emitting an error, it was throwing an error because `res` was `undefined` when checking for `statusCode`.