Update
This commit is contained in:
@@ -1,18 +1,35 @@
|
||||
from abc import ABC
|
||||
from typing import Dict
|
||||
from urllib.parse import SplitResult
|
||||
|
||||
|
||||
class Message:
|
||||
class Message(ABC):
|
||||
version: str
|
||||
status: int
|
||||
msg: str
|
||||
headers: Dict[str, str]
|
||||
raw: str
|
||||
body: bytes
|
||||
|
||||
def __init__(self, version: str, status: int, msg: str, headers: Dict[str, str], raw=None, body: bytes = None):
|
||||
def __init__(self, version: str, headers: Dict[str, str], raw=None, body: bytes = None):
|
||||
self.version = version
|
||||
self.status = status
|
||||
self.msg = msg
|
||||
self.headers = headers
|
||||
self.raw = raw
|
||||
self.body = body
|
||||
|
||||
|
||||
class ClientMessage(Message):
|
||||
status: int
|
||||
msg: str
|
||||
|
||||
def __init__(self, version: str, status: int, msg: str, headers: Dict[str, str], raw=None, body: bytes = None):
|
||||
super().__init__(version, headers, raw, body)
|
||||
self.status = status
|
||||
|
||||
|
||||
class ServerMessage(Message):
|
||||
method: str
|
||||
target: SplitResult
|
||||
|
||||
def __init__(self, version: str, method: str, target, headers: Dict[str, str], raw=None, body: bytes = None):
|
||||
super().__init__(version, headers, raw, body)
|
||||
self.method = method
|
||||
self.target = target
|
||||
|
Reference in New Issue
Block a user