Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template: reuse LazyResponse for rendered response #244

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Huy-Ngo
Copy link

@Huy-Ngo Huy-Ngo commented Mar 20, 2024

Previously, only status, headers, and content type are passed to the final rendered response. After this change, the LazyResponse is preserved and only has its body changed after rendering. This allows for, e.g., setting cookie for the LazyResponse.

@Huy-Ngo
Copy link
Author

Huy-Ngo commented Mar 20, 2024

(Leaving this as draft because I haven't written tests and update the doc for this.)

Previously, only status, headers, and content type are passed to the
final rendered response.  After this change, the LazyResponse is
preserved and only has its body changed after rendering.  This allows
for, e.g., setting cookie for the LazyResponse.
@Huy-Ngo Huy-Ngo force-pushed the templating-preserve-response branch from fd9513a to 4bad4f0 Compare March 21, 2024 03:31
@Huy-Ngo Huy-Ngo marked this pull request as ready for review March 21, 2024 03:32
@Huy-Ngo
Copy link
Author

Huy-Ngo commented Mar 21, 2024

Fixed up the tests. I see OAS tests failing, but that's not related. I want to add a test with cookies but response.cookies doesn't seem to return a CookieJar as documented but rather httpx.Cookie, which is weird.

Not sure where to write doc though.

Copy link
Member

@ahopkins ahopkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to approve once we have some tests. Thanks for this addition.

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.

None yet

2 participants