mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-05-06 23:34:18 +00:00
Allow GET requests
This commit is contained in:
parent
85ca9e3efb
commit
7611cd1cdb
@ -110,7 +110,13 @@ export const createAndStartServer = async (
|
||||
app.use(
|
||||
ETH_RPC_PATH,
|
||||
jsonParser(),
|
||||
// TODO: Handle GET requests as well to match Geth's behaviour
|
||||
(req: any, res: any, next: () => void) => {
|
||||
// Convert all GET requests to POST to avoid getting rejected from jayson server middleware
|
||||
if (jayson.Utils.isMethod(req, 'GET')) {
|
||||
req.method = 'POST';
|
||||
}
|
||||
next();
|
||||
},
|
||||
rpcServer.middleware()
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user