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

Set response Status Code to 200 in error handler #114

Closed
rudolpjo opened this issue Nov 15, 2020 · 0 comments
Closed

Set response Status Code to 200 in error handler #114

rudolpjo opened this issue Nov 15, 2020 · 0 comments
Assignees
Labels

Comments

@rudolpjo
Copy link

Within the error handling function that is decorated by the error handler, a redirect to another function, which should then return a status of 200, cannot do so. The check on line 53 of flask_httpauth.py prevents the user from setting status code 200.

def get_public_data(status):
    ...
    return ("OK", 200)   # status code reset to 401

@auth.error_handler
def auth_error_handler(status):
    if request.method == 'GET':
        return get_public_data(status) # cannot set response status code to 200
    else:
        return ({"Error": "Unauthorized Access"}, status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants