Skip to content

Commit

Permalink
Unsupported Media Type Error added
Browse files Browse the repository at this point in the history
  • Loading branch information
JirkaChadima committed Mar 29, 2012
1 parent 875476b commit d252c31
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions web/webapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"Redirect", "Found", "SeeOther", "NotModified", "TempRedirect",
"redirect", "found", "seeother", "notmodified", "tempredirect",

# 400, 401, 403, 404, 405, 406, 409, 410, 412
"BadRequest", "Unauthorized", "Forbidden", "NotFound", "NoMethod", "NotAcceptable", "Conflict", "Gone", "PreconditionFailed",
"badrequest", "unauthorized", "forbidden", "notfound", "nomethod", "notacceptable", "conflict", "gone", "preconditionfailed",
# 400, 401, 403, 404, 405, 406, 409, 410, 412, 415
"BadRequest", "Unauthorized", "Forbidden", "NotFound", "NoMethod", "NotAcceptable", "Conflict", "Gone", "PreconditionFailed", "UnsupportedMediaType",
"badrequest", "unauthorized", "forbidden", "notfound", "nomethod", "notacceptable", "conflict", "gone", "preconditionfailed", "unsupportedmediatype",

# 500
"InternalError",
Expand Down Expand Up @@ -226,6 +226,16 @@ def __init__(self):

preconditionfailed = PreconditionFailed

class UnsupportedMediaType(HTTPError):
"""`415 Unsupported Media Type` error."""
message = "unsupported media type"
def __init__(self):
status = "415 Unsupported Media Type"
headers = {'Content-Type': 'text/html'}
HTTPError.__init__(self, status, headers, self.message)

unsupportedmediatype = UnsupportedMediaType

class _InternalError(HTTPError):
"""500 Internal Server Error`."""
message = "internal server error"
Expand Down

0 comments on commit d252c31

Please sign in to comment.