Skip to content

Commit

Permalink
fixes bug in configure_redirects (#5761)
Browse files Browse the repository at this point in the history
* fixes bug in configure_redirects

* changes redirects_allow to permit_redirects to be unambigiously boolean
  • Loading branch information
kristapratico authored Jun 10, 2019
1 parent 47fc3c4 commit bf65ba0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sdk/core/azure-core/azure/core/pipeline/policies/redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RedirectPolicy(HTTPPolicy):
**Keyword arguments:**
*redirects_allow (int)* - Whether the client allows redirects. Defaults to True.
*permit_redirects (bool)* - Whether the client allows redirects. Defaults to True.
*redirect_max (int)* - The maximum allowed redirects. Defaults to 30.
Expand All @@ -67,7 +67,7 @@ class RedirectPolicy(HTTPPolicy):
REDIRECT_HEADERS_BLACKLIST = frozenset(['Authorization'])

def __init__(self, **kwargs):
self.allow = kwargs.get('redirects_allow', True)
self.allow = kwargs.get('permit_redirects', True)
self.max_redirects = kwargs.get('redirect_max', 30)

remove_headers = set(kwargs.get('redirect_remove_headers', []))
Expand All @@ -80,7 +80,7 @@ def __init__(self, **kwargs):
def no_redirects(cls):
"""Disable redirects.
"""
return cls(redirects_allow=False)
return cls(permit_redirects=False)

def configure_redirects(self, options):
"""Configures the redirect settings.
Expand All @@ -90,7 +90,7 @@ def configure_redirects(self, options):
:rtype: dict
"""
return {
'allow': options.pop("redirects_allow", self.max_redirects),
'allow': options.pop("permit_redirects", self.allow),
'redirects': options.pop("redirect_max", self.max_redirects),
'history': []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AsyncRedirectPolicy(RedirectPolicy, AsyncHTTPPolicy): # type: ignore
**Keyword arguments:**
*redirects_allow (int)* - Whether the client allows redirects. Defaults to True.
*permit_redirects (bool)* - Whether the client allows redirects. Defaults to True.
*redirect_max (int)* - The maximum allowed redirects. Defaults to 30.
Expand Down

0 comments on commit bf65ba0

Please sign in to comment.