Added allowRedirect function. Should return true if redirect is allowed or false otherwise

Added allowRedirect function which should return true if redirect is allowed or false otherwise

This allows to stop following redirects based on response headers, status or any other response property. For example checking that certain URL has been reached would look like:

    request(url, {
        followRedirect: true,
        allowRedirect: function(response) {
            var currentUrl = (response.headers && response.headers.location) || '';
            if (/some regex/.test(currentUrl)) {
                return false;
            }
            return true;
        }
    })