Skip to content

Commit f95781a

Browse files
committed
Rewrite of Response logic from context managers to returns, added some new types of response
1 parent e3529d6 commit f95781a

File tree

5 files changed

+328
-254
lines changed

5 files changed

+328
-254
lines changed

adafruit_httpserver/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
InvalidPathError,
3636
ParentDirectoryReferenceError,
3737
BackslashInPathError,
38-
ResponseAlreadySentError,
3938
ServingFilesDisabledError,
4039
FileNotExistsError,
4140
)
@@ -53,7 +52,13 @@
5352
)
5453
from .mime_types import MIMETypes
5554
from .request import Request
56-
from .response import Response
55+
from .response import (
56+
Response,
57+
FileResponse,
58+
ChunkedResponse,
59+
JSONResponse,
60+
Redirect,
61+
)
5762
from .server import Server
5863
from .status import (
5964
Status,

adafruit_httpserver/exceptions.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ def __init__(self, path: str) -> None:
4646
super().__init__(f"Backslash in path: {path}")
4747

4848

49-
class ResponseAlreadySentError(Exception):
50-
"""
51-
Another ``Response`` has already been sent. There can only be one per ``Request``.
52-
"""
53-
54-
5549
class ServingFilesDisabledError(Exception):
5650
"""
5751
Raised when ``root_path`` is not set and there is no handler for ``request``.

0 commit comments

Comments
 (0)