Skip to content

Commit bc11e52

Browse files
committed
pass headers for all collection ops
1 parent f9edea5 commit bc11e52

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

backend/btrixcloud/colls.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ async def clear_org_previous_slugs_matching_slug(
222222
)
223223

224224
async def add_crawls_to_collection(
225-
self, coll_id: UUID, crawl_ids: List[str], org: Organization
225+
self,
226+
coll_id: UUID,
227+
crawl_ids: List[str],
228+
org: Organization,
229+
headers: Optional[dict] = None,
226230
) -> CollOut:
227231
"""Add crawls to collection"""
228232
await self.crawl_ops.add_to_collection(crawl_ids, coll_id, org)
@@ -245,10 +249,14 @@ async def add_crawls_to_collection(
245249
)
246250
)
247251

248-
return await self.get_collection_out(coll_id, org)
252+
return await self.get_collection_out(coll_id, org, headers)
249253

250254
async def remove_crawls_from_collection(
251-
self, coll_id: UUID, crawl_ids: List[str], org: Organization
255+
self,
256+
coll_id: UUID,
257+
crawl_ids: List[str],
258+
org: Organization,
259+
headers: Optional[dict] = None,
252260
) -> CollOut:
253261
"""Remove crawls from collection"""
254262
await self.crawl_ops.remove_from_collection(crawl_ids, coll_id)
@@ -270,7 +278,7 @@ async def remove_crawls_from_collection(
270278
)
271279
)
272280

273-
return await self.get_collection_out(coll_id, org)
281+
return await self.get_collection_out(coll_id, org, headers)
274282

275283
async def get_collection_raw(
276284
self, coll_id: UUID, oid: UUID, public_or_unlisted_only: bool = False
@@ -1067,9 +1075,11 @@ async def get_collection_search_values(
10671075
response_model=CollOut,
10681076
)
10691077
async def get_collection(
1070-
coll_id: UUID, org: Organization = Depends(org_viewer_dep)
1078+
coll_id: UUID, request: Request, org: Organization = Depends(org_viewer_dep)
10711079
):
1072-
return await colls.get_collection_out(coll_id, org)
1080+
return await colls.get_collection_out(
1081+
coll_id, org, headers=dict(request.headers)
1082+
)
10731083

10741084
@app.get(
10751085
"/orgs/{oid}/collections/{coll_id}/replay.json",
@@ -1136,9 +1146,12 @@ async def update_collection(
11361146
async def add_crawl_to_collection(
11371147
crawlList: AddRemoveCrawlList,
11381148
coll_id: UUID,
1149+
request: Request,
11391150
org: Organization = Depends(org_crawl_dep),
11401151
) -> CollOut:
1141-
return await colls.add_crawls_to_collection(coll_id, crawlList.crawlIds, org)
1152+
return await colls.add_crawls_to_collection(
1153+
coll_id, crawlList.crawlIds, org, headers=dict(request.headers)
1154+
)
11421155

11431156
@app.post(
11441157
"/orgs/{oid}/collections/{coll_id}/remove",
@@ -1148,10 +1161,11 @@ async def add_crawl_to_collection(
11481161
async def remove_crawl_from_collection(
11491162
crawlList: AddRemoveCrawlList,
11501163
coll_id: UUID,
1164+
request: Request,
11511165
org: Organization = Depends(org_crawl_dep),
11521166
) -> CollOut:
11531167
return await colls.remove_crawls_from_collection(
1154-
coll_id, crawlList.crawlIds, org
1168+
coll_id, crawlList.crawlIds, org, headers=dict(request.headers)
11551169
)
11561170

11571171
@app.delete(

0 commit comments

Comments
 (0)