Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Dec 18, 2024
1 parent 59dcff2 commit 4c8d9f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions integration_tests/base_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pathlib
from collections import defaultdict
from typing import Optional
import json

from integration_tests.subroutes import di_subrouter, sub_router
from integration_tests.views import AsyncView, SyncView
Expand Down
13 changes: 10 additions & 3 deletions robyn/robyn.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from __future__ import annotations

from dataclasses import dataclass
from enum import Enum
from typing import Callable, Optional, Union
from typing import Callable, Optional, Union, Iterator, AsyncIterator, Generator, AsyncGenerator

def get_version() -> str:
pass
Expand Down Expand Up @@ -287,14 +287,21 @@ class Response:
status_code (int): The status code of the response. e.g. 200, 404, 500 etc.
response_type (Optional[str]): The response type of the response. e.g. text, json, html, file etc.
headers (Union[Headers, dict]): The headers of the response or Headers directly. e.g. {"Content-Type": "application/json"}
description (Union[str, bytes, Callable]): The body of the response. Can be a string, bytes, or an iterator/generator for streaming.
description (Union[str, bytes, Iterator[bytes], AsyncIterator[bytes], Generator[bytes, None, None], AsyncGenerator[bytes, None]]):
The body of the response. Can be:
- str: Plain text response
- bytes: Binary response
- Iterator[bytes]: Sync iterator yielding bytes
- AsyncIterator[bytes]: Async iterator yielding bytes
- Generator[bytes, None, None]: Sync generator yielding bytes
- AsyncGenerator[bytes, None]: Async generator yielding bytes
file_path (Optional[str]): The file path of the response. e.g. /home/user/file.txt
streaming (bool): Whether the response is a streaming response. If True, description should be an iterator/generator.
"""

status_code: int
headers: Union[Headers, dict]
description: Union[str, bytes, Callable]
description: Union[str, bytes, Iterator[bytes], AsyncIterator[bytes], Generator[bytes, None, None], AsyncGenerator[bytes, None]]
streaming: bool = False
response_type: Optional[str] = None
file_path: Optional[str] = None
Expand Down

0 comments on commit 4c8d9f2

Please sign in to comment.