Update
This commit is contained in:
@@ -33,6 +33,10 @@ class HTTPServerException(Exception):
|
||||
""" Base class for HTTP Server exceptions """
|
||||
status_code: str
|
||||
message: str
|
||||
body: str
|
||||
|
||||
def __init__(self, body=""):
|
||||
self.body = body
|
||||
|
||||
|
||||
class BadRequest(HTTPServerException):
|
||||
@@ -66,3 +70,28 @@ class NotFound(HTTPServerException):
|
||||
""" Resource not found """
|
||||
status_code = 404
|
||||
message = "Not Found"
|
||||
|
||||
|
||||
class Forbidden(HTTPServerException):
|
||||
""" Request not allowed """
|
||||
status_code = 403
|
||||
message = "Forbidden"
|
||||
|
||||
|
||||
class Conflict(HTTPServerException):
|
||||
""" Conflict in the current state of the target resource """
|
||||
status_code = 409
|
||||
message = "Conflict"
|
||||
|
||||
|
||||
class HTTPVersionNotSupported(HTTPServerException):
|
||||
""" The server does not support the major version HTTP used in the request message """
|
||||
status_code = 505
|
||||
message = "HTTP Version Not Supported"
|
||||
|
||||
|
||||
class InvalidRequestLine(BadRequest):
|
||||
""" Request start-line is invalid """
|
||||
|
||||
def __init__(self, line):
|
||||
self.request_line = line
|
||||
|
Reference in New Issue
Block a user