Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/datastar_py/sanic.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def __init__(

async def send(
self,
event: DatastarEvent | None = None,
data: DatastarEvent | None = None,
end_stream: bool | None = None,
) -> None:
if event and self.status == 204:
if data and self.status == 204:
# When the response is created with no content, it's set to a 204 by default
# if we end up streaming to it, change the status code to 200 before sending.
self.status = 200
await super().send(event, end_stream=end_stream)
await super().send(data, end_stream=end_stream)


async def datastar_respond(
Expand Down Expand Up @@ -96,5 +96,5 @@ async def wrapper(*args: P.args, **kwargs: P.kwargs) -> DatastarResponse | None:
return wrapper


async def read_signals(request: Request) -> dict[str, Any] | None:
async def read_signals(request: Request[Any, Any]) -> dict[str, Any] | None:
return _read_signals(request.method, request.headers, request.args, request.body)