fix: Remove ability to use GET for RPC API requests by default (#4042)

* fix: Remove ability to use GET for RPC API requests by default

* tsc
This commit is contained in:
Tom Moor
2022-09-02 10:05:40 +02:00
committed by GitHub
parent 2d29f0f042
commit c85f3bd7b4
10 changed files with 85 additions and 31 deletions

View File

@@ -3,11 +3,10 @@ import queryString from "query-string";
export default function methodOverride() {
return async function methodOverrideMiddleware(ctx: Context, next: Next) {
// TODO: Need to remove this use of ctx.body to enable proper typing of requests
if (ctx.method === "POST") {
ctx.body = ctx.request.body;
} else if (ctx.method === "GET") {
ctx.method = 'POST'; // eslint-disable-line
ctx.body = queryString.parse(ctx.querystring);
}