Skip to content

Commit

Permalink
Merge pull request #412 from sjaensch/fix-fido-response-text-type
Browse files Browse the repository at this point in the history
Make sure response.text returns an unicode string for the fido client
  • Loading branch information
sjaensch committed Mar 25, 2019
2 parents dcf3462 + 36f7d31 commit b8e9115
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 2 additions & 3 deletions bravado/fido_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
if getattr(typing, 'TYPE_CHECKING', False):
class _FidoStub(typing.Protocol):
code = None # type: int
body = None # type: str
body = None # type: bytes
reason = None # type: typing.Text
headers = None # type: typing.Mapping[bytes, typing.List[bytes]]

Expand Down Expand Up @@ -56,7 +56,7 @@ def status_code(self):
@property
def text(self):
# type: () -> typing.Text
return self._delegate.body
return self._delegate.body.decode('utf-8') # this is what _delegate.json() does as well

@property
def raw_bytes(self):
Expand Down Expand Up @@ -90,7 +90,6 @@ def headers(self):

def json(self, **_):
# type: (typing.Any) -> typing.Mapping[typing.Text, typing.Any]
# TODO: pass the kwargs downstream
return self._delegate.json()


Expand Down
4 changes: 0 additions & 4 deletions tests/integration/fido_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ class TestServerFidoClient(IntegrationTestsBaseClass):
twisted.internet.error.DNSLookupError(),
twisted.web.client.RequestNotSent(),
}

@classmethod
def encode_expected_response(cls, response):
return response

0 comments on commit b8e9115

Please sign in to comment.