Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9348022
D2244.id7757.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
948 B
Subscribers
None
D2244.id7757.diff
View Options
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
Details
Attached
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
Attached To
D2244: REST server: set content-type to text or ndjson where appropriate
Event Timeline
Log In to Comment