File tree Expand file tree Collapse file tree 5 files changed +20
-12
lines changed Expand file tree Collapse file tree 5 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -44,9 +44,13 @@ io-uring = ["actix-web/experimental-io-uring"]
4444
4545[profile .release ]
4646codegen-units = 1
47- lto = true
47+ lto = " fat "
4848panic = " abort"
4949strip = true
50+ opt-level = 3
51+
52+ [profile .release .build-override ]
53+ opt-level = 3
5054
5155[package .metadata .maturin ]
5256name = " robyn"
Original file line number Diff line number Diff line change 3030 let function_args: PyObject = function_args
3131 . clone ( )
3232 . into_pyobject ( py)
33- . unwrap ( )
33+ . map_err ( |e| {
34+ PyErr :: new :: < pyo3:: exceptions:: PyRuntimeError , _ > ( format ! (
35+ "Failed to convert args: {:?}" ,
36+ e
37+ ) )
38+ } ) ?
3439 . into_any ( )
3540 . unbind ( ) ;
3641 debug ! ( "Function args: {:?}" , function_args) ;
Original file line number Diff line number Diff line change @@ -545,13 +545,11 @@ async fn index(
545545 response = match execute_middleware_function ( & response, & after_middleware) . await {
546546 Ok ( MiddlewareReturn :: Request ( _) ) => {
547547 error ! ( "After middleware returned a request" ) ;
548- return Response :: internal_server_error ( Some ( & response . headers ) ) ;
548+ return Response :: internal_server_error ( None ) ;
549549 }
550550 Ok ( MiddlewareReturn :: Response ( r) ) => {
551- let response = r;
552-
553- debug ! ( "Response returned: {:?}" , response) ;
554- response
551+ debug ! ( "Response returned: {:?}" , r) ;
552+ r
555553 }
556554 Err ( e) => {
557555 error ! (
Original file line number Diff line number Diff line change @@ -41,9 +41,9 @@ impl<'py> IntoPyObject<'py> for Request {
4141 let body = if self . body . is_empty ( ) {
4242 PyString :: new ( py, "" ) . into_any ( )
4343 } else {
44- match String :: from_utf8 ( self . body . clone ( ) ) {
45- Ok ( s) => s . into_pyobject ( py) ? . into_any ( ) ,
46- Err ( _) => self . body . into_pyobject ( py ) ? . into_any ( ) ,
44+ match std :: str :: from_utf8 ( & self . body ) {
45+ Ok ( s) => PyString :: new ( py, s ) . into_any ( ) ,
46+ Err ( _) => PyBytes :: new ( py , & self . body ) . into_any ( ) ,
4747 }
4848 } ;
4949
Original file line number Diff line number Diff line change @@ -27,8 +27,9 @@ impl Responder for Response {
2727 type Body = BoxBody ;
2828
2929 fn respond_to ( self , _req : & HttpRequest ) -> HttpResponse < Self :: Body > {
30- let mut response_builder =
31- HttpResponseBuilder :: new ( StatusCode :: from_u16 ( self . status_code ) . unwrap ( ) ) ;
30+ let mut response_builder = HttpResponseBuilder :: new (
31+ StatusCode :: from_u16 ( self . status_code ) . unwrap_or ( StatusCode :: INTERNAL_SERVER_ERROR ) ,
32+ ) ;
3233 apply_hashmap_headers ( & mut response_builder, & self . headers ) ;
3334 response_builder. body ( self . description )
3435 }
You can’t perform that action at this time.
0 commit comments