Requires decorator redirects with 303 status_code instead of 307 #927 (#929)

This commit is contained in:
Piotr Staroszczyk 2020-05-04 12:13:45 +02:00 committed by GitHub
parent 311e0a8886
commit d94e45f3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -62,7 +62,9 @@ def requires(
if not has_required_scope(request, scopes_list):
if redirect is not None:
return RedirectResponse(url=request.url_for(redirect))
return RedirectResponse(
url=request.url_for(redirect), status_code=303
)
raise HTTPException(status_code=status_code)
return await func(*args, **kwargs)
@ -77,7 +79,9 @@ def requires(
if not has_required_scope(request, scopes_list):
if redirect is not None:
return RedirectResponse(url=request.url_for(redirect))
return RedirectResponse(
url=request.url_for(redirect), status_code=303
)
raise HTTPException(status_code=status_code)
return func(*args, **kwargs)