Bug #4501

Views should return 405 (Method Not Allowed) instead of raising (500) AssertionError for not allowed request methods

Added by Sofia Papagiannaki about 7 years ago. Updated about 7 years ago.

Status:Resolved Start date:10/22/2013
Priority:Medium Due date:
Assignee:Sofia Papagiannaki % Done:

0%

Category:Pithos Spent time: -
Target version:0.15

Description

Eliminate the following assertion:

Traceback (most recent call last):

File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 100, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/dist-packages/pithos/api/util.py", line 1112, in wrapper
token = get_token_from_cookie(request)
File "/usr/lib/python2.6/dist-packages/pithos/api/util.py", line 1098, in get_token_from_cookie
"Cookie based authentication is only allowed to GET requests"

AssertionError: Cookie based authentication is only allowed to GET requests

Associated revisions

Revision 3dce76b5
Added by Sofia Papagiannaki about 7 years ago

pithos: Eliminate AssertionError in views

Remove check for not allowed request method in view_method() decorator.
Let the api_method() decorator handle such cases.

Refs: #4501

History

#1 Updated by Sofia Papagiannaki about 7 years ago

The common api_method() decorator in such cases returns 400 (Bad Request)

#2 Updated by Sofia Papagiannaki about 7 years ago

  • Status changed from Assigned to Resolved

Also available in: Atom PDF