mirror of
https://github.com/brunopostle/ifcurl.git
synced 2026-07-12 10:18:14 +00:00
Add GET /preview endpoint for HTML img tag use
POST /preview requires a JSON body so cannot be used in <img src>. The new GET /preview?url=... delegates to the same handler and shares all caching and authentication behaviour.
This commit is contained in:
parent
778f0004e7
commit
502e497d92
1 changed files with 11 additions and 1 deletions
|
|
@ -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 ``<img src>`` 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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue