KoaJs making a post request

  javascript, koa

I am trying to make a post request to a 3rd party api from my koa-js api. Here is my code

let saveUserResponse = await ctx.post(url, ctx.request.body, {
  'User-Agent': 'koa-http-request',
  'content-type': 'application/json',
});

I am getting a 400 response code from that. I suspect that the body of my request is not being sent properly. Can you please assist?

Source: Ask Javascript Questions

LEAVE A COMMENT