How to get post body with Koa-router-forward-request?

421 Views Asked by At

I have the koa-router-forward-request set up. I make an axios call to it and that call is forwarded onto an API. I can do get requests and retrieve the information. I can't get post requests working. I want to forward the post request body from the original axios call onto the API how do I do that?

I have const composeRequest = body; and in the request I have composeBody: composeRequest as an attribute but that does not seem to be working.

1

There are 1 best solutions below

0
On

This is super late but I think what you are looking for is maybe to 1. ensure you are using bodyParser() i.e. router.use(bodyParser()) and 2. when hitting the Koa route pull any params you pass via Axios by ctx.request.body, all params should be stored in there to pull out.