File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,8 @@ impl Server {
8484 match work_request {
8585 Ok ( work_request) => {
8686 // Call the Ruby block and handle the response
87- let warp_response = match block. call :: < _ , Value > ( ( work_request. request , ) ) {
87+ let req_ref = Obj :: wrap ( work_request. request ) ;
88+ let warp_response = match block. call :: < _ , Value > ( [ req_ref] ) {
8889 Ok ( result) => {
8990 let ref_response = Obj :: < Response > :: try_convert ( result) . unwrap ( ) ;
9091
@@ -148,8 +149,6 @@ impl Server {
148149 . build ( )
149150 . map_err ( |e| MagnusError :: new ( magnus:: exception:: runtime_error ( ) , e. to_string ( ) ) ) ?;
150151
151- println ! ( "Starting server" ) ;
152-
153152 rt. block_on ( async {
154153 let work_tx = work_tx. clone ( ) ;
155154
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use warp::http::HeaderMap;
44
55// Type passed to ruby giving access to the request properties.
66#[ derive( Debug ) ]
7- #[ magnus:: wrap( class = "HyperRuby::Request" ) ]
7+ #[ magnus:: wrap( class = "HyperRuby::Request" , free_immediately ) ]
88pub struct Request {
99 pub method : warp:: http:: Method ,
1010 pub path : String ,
Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ def test_large_post
3535 end
3636 end
3737
38+ def test_blocking
39+ with_server ( -> ( request ) { handler_simple ( request ) } ) do |client |
40+ gets
41+ end
42+ end
43+
3844 def with_server ( request_handler , &block )
3945 server = HyperRuby ::Server . new
4046 server . configure ( { bind_address : "127.0.0.1:3010" } )
@@ -60,7 +66,7 @@ def with_server(request_handler, &block)
6066 end
6167
6268 def handler_simple ( request )
63- HyperRuby ::Response . new ( 200 , { 'Content-Type' => 'text/plain' } , request . http_method )
69+ HyperRuby ::Response . new ( 200 , { 'Content-Type' => 'text/plain' } , "ABC" )
6470 end
6571
6672 def handler_to_json ( request )
You can’t perform that action at this time.
0 commit comments