Skip to content

Commit

Permalink
Release v0.49.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Dec 10, 2023
1 parent df9d1a1 commit 8a585b8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "robyn"
version = "0.48.0"
version = "0.49.0"
authors = ["Sanskar Jethi <[email protected]>"]
edition = "2021"
description = "A web server that is fast!"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "maturin"

[project]
name = "robyn"
version = "0.48.0"
version = "0.49.0"
description = "A High-Performance, Community-Driven, and Innovator Friendly Web Framework with a Rust runtime."
authors = [{ name = "Sanskar Jethi", email = "[email protected]" }]
repository = "https://github.com/sparckles/robyn"
Expand Down Expand Up @@ -43,7 +43,7 @@ Changelog = "https://github.com/sparckles/robyn/blob/main/CHANGELOG.md"

[tool.poetry]
name = "robyn"
version = "0.48.0"
version = "0.49.0"
description = "A High-Performance, Community-Driven, and Innovator Friendly Web Framework with a Rust runtime."
authors = ["Sanskar Jethi <[email protected]>"]

Expand Down
12 changes: 8 additions & 4 deletions src/executors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[deny(clippy::if_same_then_else)]
/// This is the module that has all the executor functions
/// i.e. the functions that have the responsibility of parsing and executing functions.
pub mod web_socket_executors;
Expand Down Expand Up @@ -31,21 +32,24 @@ where
match function.number_of_params {
0 => handler.call0(),
1 => {
if function.args.as_ref(py).get_item("request").is_some() {
handler.call1((function_args,))
} else if function.args.as_ref(py).get_item("response").is_some() {
// this is for middlewares
if function.args.as_ref(py).get_item("request").is_some()
|| function.args.as_ref(py).get_item("response").is_some()
{
// If 'request' is present, call handler with 'function_args'
handler.call1((function_args,))
} else {
// If neither 'request' nor 'response' is present
handler.call((), Some(kwargs))
}
}
2 => {
if function.args.as_ref(py).get_item("request").is_some()
|| function.args.as_ref(py).get_item("response").is_some()
{
// If either 'request' or 'response' is present, call handler with 'function_args' and 'kwargs'
handler.call((function_args,), Some(kwargs))
} else {
// If neither 'request' nor 'response' is present
handler.call((), Some(kwargs))
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ async fn index(
request.path_params = route_params;
}
for before_middleware in before_middlewares {
request = match execute_middleware_function(&mut request, &before_middleware).await {
request = match execute_middleware_function(&request, &before_middleware).await {
Ok(MiddlewareReturn::Request(r)) => r,
Ok(MiddlewareReturn::Response(r)) => {
// If a before middleware returns a response, we abort the request and return the response
Expand Down Expand Up @@ -449,7 +449,7 @@ async fn index(
after_middlewares.push(function);
}
for after_middleware in after_middlewares {
response = match execute_middleware_function(&mut response, &after_middleware).await {
response = match execute_middleware_function(&response, &after_middleware).await {
Ok(MiddlewareReturn::Request(_)) => {
error!("After middleware returned a request");
return Response::internal_server_error(Some(&response.headers));
Expand Down

0 comments on commit 8a585b8

Please sign in to comment.