-
-
Notifications
You must be signed in to change notification settings - Fork 387
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
feat: make 302
the default status_code
for redirect responses
#2189
Conversation
Ensure deterministic handler order
* Support custom status code for openapi exceptions * add docs for custom exceptions in OpenAPI schemas --------- Co-authored-by: Na'aman Hirschfeld <[email protected]>
doc(openapi): fix stdlib link Signed-off-by: Janek Nouvertné <[email protected]>
302
the default status_code
for Redirect
302
the default status_code
for Redirect302
the default status_code
for redirect responses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the default in ASGIRedirectResponse
be changed as well?
I wasn't exactly sure here. I see this line in the status_code = status_code or HTTP_307_TEMPORARY_REDIRECT @provinzkraut what do you think? |
Hmm. It might be a bit unexpected if the two different redirects available use different defaults for the status code. I do believe though that the But this raises the question whether this ought to be considered a breaking change. It'd be more of a breaking bugfix really 🤔 |
I agree that having different defaults for the different redirects seems a bit confusing. On the topic of the breaking change, it seems this change is the one that will actually document that the default is 302, and so the previous use of 307 was undocumented and could be considered an implementation detail. I don't know...I may be stretching this a bit too much :P |
Well, it is true. The original default was undocumented. However, i think it could be considered breaking if anyone's existing code is set to look for the 307 instead of the 302. I'm fine with any approach y'all are good with on this. |
I think we should treat this as such, which means this would have to be postponed to the next major version. |
Then maybe we should document that the current default is 307? |
So how do we handle these types of changes, do we need to create the next major version branch now? |
Well.. I don't really want to have another branch like that for a year. I'd say we just put this into the |
Does that mean this PR and the associated bug has to be kept open as well? |
I'd close the PR but keep the issue. Wdyt? |
Merge + feature flag is a good combo imo. |
The issue I see with that is that the feature flag implementation would require more code than the actual change. It's a really trivial change, so imo we should just postpone it. |
Co-authored-by: Na'aman Hirschfeld <[email protected]>
Kudos, SonarCloud Quality Gate passed! |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/2189 |
Fixes #2138
Pull Request Checklist
Description
This PR will set the Redirect status code to 302 if it is left unset.
Close Issue(s)
Closes #2138