Skip to content

Commit

Permalink
Automatically handle HTTP OPTIONS.
Browse files Browse the repository at this point in the history
  • Loading branch information
bohde authored and toastdriven committed Feb 10, 2011
1 parent e500c98 commit af8fe73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tastypie/resources.py
Expand Up @@ -414,6 +414,12 @@ def method_check(self, request, allowed=None):

request_method = request.method.lower()

if request_method == "options":
allows = ','.join(map(str.upper, allowed))
response = HttpResponse(allows)
response['Allow'] = allows
raise ImmediateHttpResponse(response=response)

if not request_method in allowed:
raise ImmediateHttpResponse(response=HttpMethodNotAllowed())

Expand Down

0 comments on commit af8fe73

Please sign in to comment.