Skip to content

Commit

Permalink
Merge pull request #113 from filip75/feature/http-401-fix
Browse files Browse the repository at this point in the history
Fix handling unauthorized
  • Loading branch information
glow-mdsol committed May 6, 2021
2 parents ef21eb4 + 74603ff commit 395b0a1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Expand Up @@ -9,3 +9,4 @@ Authors
- Oli Quinet <https://github.com/Oli76>
- Daniel Smoczyk <https://github.com/dPeS>
- Bastien Gerard <https://github.com/bagerard>
- Filip Janowski <https://github.com/filip75>
4 changes: 2 additions & 2 deletions rwslib/__init__.py
Expand Up @@ -3,7 +3,7 @@
__title__ = "rwslib"
__author__ = "Ian Sparks (isparks@trialgrid.com)"
__maintainer__ = "Geoff Low (glow@mdsol.com)"
__version__ = "1.2.7"
__version__ = "1.2.8"
__license__ = "MIT"
__copyright__ = "Copyright 2021 Medidata Solutions Inc"

Expand Down Expand Up @@ -147,7 +147,7 @@ def send_request(self, request_object, timeout=None, retries=1, **kwargs):
if r.text == "Authorization Header not provided":
raise AuthorizationException(r.text)

if "<h2>HTTP Error 401.0 - Unauthorized</h2>" in r.text:
if "HTTP Error 401.0 - Unauthorized" in r.text:
raise RWSException("Unauthorized.", r.text)

# Check if the content_type is text/xml. Use startswith
Expand Down
2 changes: 1 addition & 1 deletion rwslib/tests/test_rwslib.py
Expand Up @@ -270,7 +270,7 @@ def test_401_error_error_response_no_header(self):
def test_401_error_error_response_unauthorized(self):
"""Parse the IIS Response Error structure"""

text = b"<h2>HTTP Error 401.0 - Unauthorized</h2>"
text = b"<h3>HTTP Error 401.0 - Unauthorized</h3>"

httpretty.register_uri(
httpretty.POST,
Expand Down

0 comments on commit 395b0a1

Please sign in to comment.