fix encode of response in client

This commit is contained in:
Cayo Puigdefabregas 2022-04-20 12:35:25 +02:00
parent 4a5ad374f8
commit 7c93fc68c5
1 changed files with 6 additions and 2 deletions

View File

@ -260,13 +260,15 @@ class UserClientFlask:
data=None, data=None,
follow_redirects=True, follow_redirects=True,
content_type='text/html; charset=utf-8', content_type='text/html; charset=utf-8',
decode=True,
**kw, **kw,
): ):
body, status, headers = self.client.get( body, status, headers = self.client.get(
uri, data=data, follow_redirects=follow_redirects, headers=self.headers uri, data=data, follow_redirects=follow_redirects, headers=self.headers
) )
body = next(body).decode("utf-8") if decode:
body = next(body).decode("utf-8")
return (body, status) return (body, status)
def post( def post(
@ -275,6 +277,7 @@ class UserClientFlask:
data=None, data=None,
follow_redirects=True, follow_redirects=True,
content_type='application/x-www-form-urlencoded', content_type='application/x-www-form-urlencoded',
decode=True,
**kw, **kw,
): ):
@ -285,5 +288,6 @@ class UserClientFlask:
headers=self.headers, headers=self.headers,
content_type=content_type, content_type=content_type,
) )
body = next(body).decode("utf-8") if decode:
body = next(body).decode("utf-8")
return (body, status) return (body, status)