From 502e497d9261e550c2576e90a96c9586fc684585 Mon Sep 17 00:00:00 2001 From: Bruno Postle Date: Thu, 16 Apr 2026 00:43:17 +0100 Subject: [PATCH] Add GET /preview endpoint for HTML img tag use POST /preview requires a JSON body so cannot be used in . The new GET /preview?url=... delegates to the same handler and shares all caching and authentication behaviour. --- ifcurl/service.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ifcurl/service.py b/ifcurl/service.py index 70fccb2..500cf5f 100644 --- a/ifcurl/service.py +++ b/ifcurl/service.py @@ -184,9 +184,19 @@ class PreviewRequest(BaseModel): # --------------------------------------------------------------------------- -# Endpoint +# Endpoints # --------------------------------------------------------------------------- +@app.get("/preview") +def preview_get(url: str) -> Response: + """GET variant of POST /preview for use in HTML ```` tags. + + The ``url`` query parameter is the ifc:// URL to render. All caching + and authentication behaviour is identical to the POST endpoint. + """ + return preview(PreviewRequest(url=url)) + + @app.post("/preview") def preview(request: PreviewRequest) -> Response: """Render an ifc:// URL to a PNG image.