AllenNeuralDynamics / aind-data-transfer-service

FastAPI service to run data compression and transfer jobs on the hpc
MIT License
1 stars 0 forks source link

Update how requests are passed to Jinja TemplateResponse #129

Open helen-m-lin opened 2 months ago

helen-m-lin commented 2 months ago

Is your feature request related to a problem? Please describe. For FastAPI>0.108.0, Starlette>0.29.0, we need to create jinja TemplateResponse with the request as a parameter rather than in the context. Otherwise, there are DeprecationWarnings.

Describe the solution you'd like

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context docs: https://fastapi.tiangolo.com/advanced/templates/

    return templates.TemplateResponse(
        request=request, name="index.html", context={"example": "example"}
    )

instead of

    return templates.TemplateResponse(
        name="index.html", context={"request": request, "example": "example"}
    )