Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Oct 22, 2024
1 parent d9440ad commit 10531fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(
self.web_socket_router = WebSocketRouter()
self.request_headers: Headers = Headers({})
self.response_headers: Headers = Headers({})
self.header_exclude_paths: Optional[List[str]] = None
self.excluded_response_header_paths: Optional[List[str]] = None
self.directories: List[Directory] = []
self.event_handlers = {}
self.exception_handler: Optional[Callable] = None
Expand Down Expand Up @@ -201,12 +201,12 @@ def set_request_header(self, key: str, value: str) -> None:
def set_response_header(self, key: str, value: str) -> None:
self.response_headers.set(key, value)

def exclude_response_headers_for(self, excluded_paths: Optional[List[str]]):
def exclude_response_headers_for(self, excluded_response_header_paths: Optional[List[str]]):
"""
To exclude response headers from certain routes
@param exclude_paths: the paths to exclude response headers from
"""
self.excluded_response_header_paths = exclude_paths
self.excluded_response_header_paths = excluded_response_header_paths

def add_web_socket(self, endpoint: str, ws: WebSocket) -> None:
self.web_socket_router.add_route(endpoint, ws)
Expand Down Expand Up @@ -293,7 +293,7 @@ def start(self, host: str = "127.0.0.1", port: int = 8080, _check_port: bool = T
self.config.workers,
self.config.processes,
self.response_headers,
self.header_exclude_paths,
self.excluded_response_header_paths,
open_browser,
)

Expand Down
8 changes: 4 additions & 4 deletions robyn/processpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def run_processes(
workers: int,
processes: int,
response_headers: Headers,
response_header_exclude_paths: Optional[List[str]],
excluded_response_header_paths: Optional[List[str]],
open_browser: bool,
) -> List[Process]:
socket = SocketHeld(url, port)
Expand All @@ -44,7 +44,7 @@ def run_processes(
workers,
processes,
response_headers,
response_header_exclude_paths,
excluded_response_header_paths,
)

def terminating_signal_handler(_sig, _frame):
Expand Down Expand Up @@ -78,7 +78,7 @@ def init_processpool(
workers: int,
processes: int,
response_headers: Headers,
response_header_exclude_paths: Optional[List[str]],
excluded_response_header_paths: Optional[List[str]],
) -> List[Process]:
process_pool = []
if sys.platform.startswith("win32") or processes == 1:
Expand Down Expand Up @@ -149,7 +149,7 @@ def spawn_process(
socket: SocketHeld,
workers: int,
response_headers: Headers,
response_header_exclude_paths: Optional[List[str]],
excluded_response_header_paths: Optional[List[str]],
):
"""
This function is called by the main process handler to create a server runtime.
Expand Down
10 changes: 5 additions & 5 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl Server {
directories: Arc::new(RwLock::new(Vec::new())),
startup_handler: None,
shutdown_handler: None,
response_header_exclude_paths: None,
excluded_response_header_paths: None,
}
}

Expand Down Expand Up @@ -110,7 +110,7 @@ impl Server {
let startup_handler = self.startup_handler.clone();
let shutdown_handler = self.shutdown_handler.clone();

let response_header_exclude_paths = self.response_header_exclude_paths.clone();
let excluded_response_header_paths = self.excluded_response_header_paths.clone();

let task_locals = pyo3_asyncio::TaskLocals::new(event_loop).copy_context(py)?;
let task_locals_copy = task_locals.clone();
Expand Down Expand Up @@ -167,7 +167,7 @@ impl Server {
.app_data(web::Data::new(middleware_router.clone()))
.app_data(web::Data::new(global_request_headers.clone()))
.app_data(web::Data::new(global_response_headers.clone()))
.app_data(web::Data::new(response_header_exclude_paths.clone()));
.app_data(web::Data::new(excluded_response_header_paths.clone()));

let web_socket_map = web_socket_router.get_web_socket_map();
for (elem, value) in (web_socket_map.read()).iter() {
Expand Down Expand Up @@ -308,7 +308,7 @@ impl Server {
&mut self,
excluded_response_header_paths: Option<Vec<String>>,
) {
self.response_header_exclude_paths = response_header_exclude_paths;
self.excluded_response_header_paths = excluded_response_header_paths;
}

/// Add a new route to the routing tables
Expand Down Expand Up @@ -428,7 +428,7 @@ async fn index(
const_router: web::Data<Arc<ConstRouter>>,
middleware_router: web::Data<Arc<MiddlewareRouter>>,
global_request_response_headers: (web::Data<Arc<Headers>>, web::Data<Arc<Headers>>),
response_header_exclude_paths: web::Data<Option<Vec<String>>>,
excluded_response_header_paths: web::Data<Option<Vec<String>>>,
req: HttpRequest,
) -> impl Responder {
let mut request = Request::from_actix_request(&req, payload, &global_request_response_headers.0).await;
Expand Down

0 comments on commit 10531fb

Please sign in to comment.