Skip to content

Commit

Permalink
fix: user session.request
Browse files Browse the repository at this point in the history
  • Loading branch information
NarekA committed Dec 5, 2023
1 parent 42f444a commit 7fbe42f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 3 additions & 2 deletions jina/serve/runtimes/gateway/request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ async def _load_balance(self, request):
except Exception:
self.logger.debug('No JSON payload found in request')

Check warning on line 171 in jina/serve/runtimes/gateway/request_handling.py

View check run for this annotation

Codecov / codecov/patch

jina/serve/runtimes/gateway/request_handling.py#L170-L171

Added lines #L170 - L171 were not covered by tests

async with _RequestContextManager(
session._request(request.method, target_url, **request_kwargs)
async with session.request(
request.method, target_url, **request_kwargs
) as response:
# Looking for application/octet-stream, text/event-stream, text/stream
if response.content_type.endswith('stream'):
Expand All @@ -197,6 +197,7 @@ async def _load_balance(self, request):
body=content,
status=response.status,
content_type=response.content_type,
headers=response.headers,
)
except aiohttp.ClientError as e:
return web.Response(text=f'Error: {str(e)}', status=500)
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/docarray_v2/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,11 @@ async def test_issue_6090_get_params(streaming_deployment):

async with session.get(url) as resp:
async for chunk in resp.content.iter_any():
print(chunk)
events = chunk.split(b'event: ')[1:]
for event in events:
if event.startswith(b'update'):
parsed = event[HTTPClientlet.UPDATE_EVENT_PREFIX:].decode()
parsed = event[HTTPClientlet.UPDATE_EVENT_PREFIX :].decode()
parsed = SimpleInput.parse_raw(parsed)
print(parsed)
docs.append(parsed)
elif event.startswith(b'end'):
pass
Expand Down

0 comments on commit 7fbe42f

Please sign in to comment.