Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Bug surrogatepass #69

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion elasticsearch_async/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign
try:
with async_timeout.timeout(timeout or self.timeout, loop=self.loop):
response = yield from self.session.request(method, url, data=body, headers=headers)
raw_data = yield from response.text()
raw_data = yield from response.content.read()
raw_data = raw_data.decode('utf-8', errors='surrogatepass')
duration = self.loop.time() - start

except asyncio.CancelledError:
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch_async/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def perform_request(self, method, url, headers=None, params=None, body=None):

if body is not None:
try:
body = body.encode('utf-8')
body = body.encode('utf-8', 'surrogatepass')
except (UnicodeDecodeError, AttributeError):
# bytes/str - no need to re-encode
pass
Expand Down