Skip to content

Fix TemplateResponse deprecation warning in Starlette#316

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-deprecation-warning-template-response
Draft

Fix TemplateResponse deprecation warning in Starlette#316
Copilot wants to merge 2 commits intomainfrom
copilot/fix-deprecation-warning-template-response

Conversation

Copy link
Contributor

Copilot AI commented Nov 23, 2025

Starlette changed the TemplateResponse signature to require Request as the first parameter instead of the template name.

Changes:

  • Updated api/routes/auth.py home route to use new signature: TemplateResponse(request, name, context) instead of TemplateResponse(name, {"request": request, ...context})
  • Removed request from context dict as it's now automatically injected
# Before
return templates.TemplateResponse(
    "chat.j2",
    {"request": request, "is_authenticated": is_authenticated_flag, ...}
)

# After
return templates.TemplateResponse(
    request,
    "chat.j2",
    {"is_authenticated": is_authenticated_flag, ...}
)
Original prompt

This section details on the original issue you should resolve

<issue_title>templating.py:162: DeprecationWarning</issue_title>
<issue_description>```
/usr/local/lib/python3.12/site-packages/starlette/templating.py:162: DeprecationWarning: The name is not the first parameter anymore. The first parameter should be the `Request` instance.
Replace `TemplateResponse(name, {"request": request})` by `TemplateResponse(request, name)`.


## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Nov 23, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix deprecation warning in templating.py Fix TemplateResponse deprecation warning in Starlette Nov 23, 2025
Copilot AI requested a review from gkorland November 23, 2025 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

templating.py:162: DeprecationWarning

2 participants