File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
server/src/middleware/http Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ use jsonrpsee_types::{Id, RequestSer};
40
40
use std:: collections:: HashMap ;
41
41
use std:: future:: Future ;
42
42
use std:: pin:: Pin ;
43
+ use std:: str:: FromStr ;
43
44
use std:: sync:: Arc ;
44
45
use std:: task:: { Context , Poll } ;
45
46
use tower:: { Layer , Service } ;
@@ -149,8 +150,12 @@ where
149
150
( Some ( method) , & Method :: GET ) => {
150
151
// RPC methods are accessed with `POST`.
151
152
* req. method_mut ( ) = Method :: POST ;
152
- // Precautionary remove the URI.
153
- * req. uri_mut ( ) = Uri :: from_static ( "/" ) ;
153
+ // Precautionary remove the URI path.
154
+ * req. uri_mut ( ) = if let Some ( query) = req. uri ( ) . query ( ) {
155
+ Uri :: from_str ( & format ! ( "/?{}" , query) ) . expect ( "The query comes from a valid URI; qed" )
156
+ } else {
157
+ Uri :: from_static ( "/" )
158
+ } ;
154
159
// Requests must have the following headers:
155
160
req. headers_mut ( ) . insert ( CONTENT_TYPE , HeaderValue :: from_static ( "application/json" ) ) ;
156
161
req. headers_mut ( ) . insert ( ACCEPT , HeaderValue :: from_static ( "application/json" ) ) ;
You can’t perform that action at this time.
0 commit comments