Skip to content

Commit

Permalink
Allow post and get
Browse files Browse the repository at this point in the history
  • Loading branch information
NarekA committed Oct 20, 2023
1 parent d4da6e9 commit 64fc314
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions jina/clients/base/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,12 @@ async def send_streaming_message(self, doc: 'Document', on: str):
:param on: Request endpoint
:yields: responses
"""
req_dict = doc.json().encode()
req_dict = doc.json()

Check warning on line 200 in jina/clients/base/helper.py

View check run for this annotation

Codecov / codecov/patch

jina/clients/base/helper.py#L200

Added line #L200 was not covered by tests

request_kwargs = {
'url': self.url,
'headers': {'Accept': 'text/event-stream'},
}
# request_kwargs['data'] = JinaJsonPayload(value=req_dict)
request_kwargs['data'] = req_dict

Check warning on line 206 in jina/clients/base/helper.py

View check run for this annotation

Codecov / codecov/patch

jina/clients/base/helper.py#L206

Added line #L206 was not covered by tests

async with self.session.post(**request_kwargs) as response:

Check warning on line 208 in jina/clients/base/helper.py

View check run for this annotation

Codecov / codecov/patch

jina/clients/base/helper.py#L208

Added line #L208 was not covered by tests
Expand Down
4 changes: 2 additions & 2 deletions jina/serve/runtimes/gateway/http_fastapi_app_docarrayv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ async def event_generator():
):
if error:
raise HTTPException(status_code=499, detail=str(error))
yield {'data': doc.dict()}
yield {'data': 'DONE'}
yield {'event': 'update', 'data': doc.dict()}
yield {'event': 'end'}

return EventSourceResponse(event_generator())

Expand Down

0 comments on commit 64fc314

Please sign in to comment.