Skip to content

Commit 1404abd

Browse files
authored
git-reader: Add HEAD support on attachments endpoints (#1078)
1 parent cb17ffc commit 1404abd

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

git-reader/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ def cert_chain(
663663
raise HTTPException(status_code=404, detail=f"{pem} not found")
664664

665665

666-
@app.get(f"/{API_PREFIX}attachments/{{path:path}}")
666+
@app.api_route(f"/{API_PREFIX}attachments/{{path:path}}", methods=["GET", "HEAD"])
667667
def attachments(
668668
request: Request,
669669
path: str,

git-reader/tests/test_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,11 @@ def test_attachment_real_file(api_client):
458458
assert len(resp.content) == 1000
459459

460460

461+
def test_attachment_supports_head(api_client):
462+
resp = api_client.head("/v2/attachments/main-workspace/regions/world.geojson")
463+
assert resp.status_code == 200
464+
465+
461466
def test_attachment_mimetype(api_client):
462467
resp = api_client.get("/v2/attachments/main-workspace/regions/world.geojson")
463468
assert resp.status_code == 200

0 commit comments

Comments
 (0)