Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #145 from JirkaChadima/unsupportedmediatype

Unsupported Media Type Error added
  • Loading branch information...
commit c7dcc24e3d8db51b2fee37c45689a779707e09dd 2 parents 875476b + d252c31
@aaronsw aaronsw authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 web/webapi.py
View
16 web/webapi.py
@@ -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",
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.