Page MenuHomeSoftware Heritage

D2244.id7757.diff
No OneTemporary

D2244.id7757.diff

diff --git a/swh/graph/server/app.py b/swh/graph/server/app.py
--- a/swh/graph/server/app.py
+++ b/swh/graph/server/app.py
@@ -23,8 +23,10 @@
@asynccontextmanager
-async def stream_response(request, *args, **kwargs):
+async def stream_response(request, content_type='text/plain',
+ *args, **kwargs):
response = aiohttp.web.StreamResponse(*args, **kwargs)
+ response.content_type = content_type
await response.prepare(request)
yield response
await response.write_eof()
@@ -101,7 +103,8 @@
src_node = backend.pid2node[src]
it = backend.visit_paths(direction, edges, src_node)
- async with stream_response(request) as response:
+ async with stream_response(request, content_type='application/x-ndjson') \
+ as response:
async for res_path in it:
res_path_pid = [backend.node2pid[n] for n in res_path]
line = json.dumps(res_path_pid)

File Metadata

Mime Type
text/plain
Expires
Jul 3 2025, 6:08 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3229264

Event Timeline