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

405 Client Error: METHOD NOT ALLOWED when api endpoint redirects #61

Open
jonblack opened this issue Oct 9, 2014 · 6 comments
Open
Labels
Milestone

Comments

@jonblack
Copy link
Contributor

jonblack commented Oct 9, 2014

When an api request is made to xssp/api/create/pdb_id/hssp_hssp (without trailing slash) the endpoint redirects to xssp/api/create/pdb_id/hssp_hssp/ with trailing slash. This is correct behaviour except that the redirect changes the request from a POST to a GET, resulting in a 405 Client Error: METHOD NOT ALLOWED

@jonblack jonblack added the bug label Oct 9, 2014
@jonblack jonblack added this to the future milestone Dec 23, 2014
@cbaakman
Copy link
Contributor

cbaakman commented Jun 19, 2017

When I try the same using python requests, I get 500 instead of 405. The logs give no output though.

@cbaakman
Copy link
Contributor

Adding the following bit of code to xssp_api/frontend/api/endpoints.py makes both work:

@bp.route('/create/<input_type>/<output_type>', methods=['POST'])
def create_xssp_no_slash(input_type, output_type):
    return create_xssp(input_type, output_type)

@jonblack
Copy link
Contributor Author

This is not the correct solution. A route with a trailing slash redirects to the route without the trailing slash. The problem is that this (in 2014) changed the request from a POST to a GET. I suspect it was a bug and is probably fixed in a new version of flask, but before upgrading, I want to reproduce it.

The 500 error is very likely unrelated. Can you first determine what the cause of the 500 error is, please?

@cbaakman
Copy link
Contributor

I see just the 500 error in the client. Nothing else. No log output from either flask or xssp_api.

@jonblack
Copy link
Contributor Author

Try and trace the cause. Something is causing the 500 error. You can add logging statements, for example.

@cbaakman
Copy link
Contributor

I think the error occurs somewhere in flask. Setting DEBUG=True however, doesn't add any log messages either.

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