File tree Expand file tree Collapse file tree 1 file changed +0
-22
lines changed
examples/do-rpc-server-client/src Expand file tree Collapse file tree 1 file changed +0
-22
lines changed Original file line number Diff line number Diff line change @@ -22,26 +22,4 @@ impl DurableObject for RPCServer {
22
22
fn new ( state : State , _env : Env ) -> Self {
23
23
Self { state, counter : 0 }
24
24
}
25
-
26
- // URL /{left}+{right}
27
- async fn fetch ( & mut self , req : Request ) -> Result < Response > {
28
- console_error_panic_hook:: set_once ( ) ;
29
- let url = req. url ( ) ?;
30
- let path = url. path ( ) ;
31
-
32
- let path = path. trim_start_matches ( '/' ) ;
33
-
34
- let path_parts: Vec < & str > = path. split ( '+' ) . collect ( ) ;
35
- if path_parts. len ( ) != 2 {
36
- return Response :: error ( "Invalid URL" , 400 ) ;
37
- }
38
-
39
- if let ( Ok ( left) , Ok ( right) ) = ( path_parts[ 0 ] . parse :: < u32 > ( ) , path_parts[ 1 ] . parse :: < u32 > ( ) )
40
- {
41
- let result = self . add ( left, right) ;
42
- Response :: ok ( & format ! ( "{} + {} = {}" , left, right, result) )
43
- } else {
44
- return Response :: error ( "Invalid operands" , 400 ) ;
45
- }
46
- }
47
25
}
You can’t perform that action at this time.
0 commit comments