Questions tagged [koa-bodyparser]

9 questions
12
votes
2 answers

Koa + TypeScript: Property 'body' does not exist on type Request

I wanted to use koa & koa-bodyparser with TypeScript but whenever I access ctx.request.body I get an error that body doesn't exist on type Request import Koa from 'koa' import Router from 'koa-router' import bodyparser from 'koa-bodyparser' const…
user10706046
6
votes
2 answers

How to access "request payload" in Koa web-framework?

We are using navigator.sendBeacon function to send data to Koa server, in which we are using bodyparser. If we not wrapped data into form then by default this function send data as request payload. How I can able to access this data on Koa…
RockStar
  • 1,304
  • 2
  • 13
  • 35
2
votes
2 answers

I can't access my request.body object in Koa JS (I am using body parser middleware but still it's not working)

My main server.js File const koa = require("koa"); const Router = require("koa-router"); const bodyParser = require("koa-bodyparser"); const app = new koa(); var router = new Router(); // app.use(bodyParser({ enableTypes: ["json", "text"] })); //…
Zain Ahmad
  • 30
  • 5
2
votes
1 answer

Cannot HTTPS POST json object at 1.5 mb via Koa and koa-body. Status 413 production only

I am attempting to upload a JSON object at about 1.5 mb from our React client to our Koa.js node.js server. I am using Koa.js with koaBody (koa-body 4.1.1). On HTTPS, in our production environment, I cannot upload the object, I receive a status of…
Gavin Thomas
  • 1,827
  • 2
  • 11
  • 17
1
vote
1 answer

Can't upload to Azure Storage after deploy Koa app to Azure App Service

When App run on local, I can upload file to Azure Blob Storage. But when I deploy app to Azure App Service, it always responses 502 Bad Gateway I use library koa-body to handle upload file const koaBody = require('koa-body')({ multipart: true,…
1
vote
0 answers

Property does not exist on type using koa parser to read body parameters

I'm trying to use koa-bodyparser to read post parameters: router.use(koaBody(), async (ctx: Context, next: () => Promise) => { if ( (!ctx.request.body || ctx.request.body.token != adminToken) ) { …
ripper234
  • 222,824
  • 274
  • 634
  • 905
0
votes
1 answer

Getting empty ctx.body on post requests in Koajs

I'm new to Koa. I wrote a simple api server with it. I have used "koa-bodyparser" and i have added content-type: application/json to the request header, but i still get empty request body on post requests. Could anyone please guide me? this is my…
Saleh Rezaei
  • 160
  • 4
  • 21
0
votes
1 answer

Koa middleware breaks execution flow, returns BadRequest Error [ERRCONNABORTED]

I have defined my custom middleware as below. It basically fetches urlencoded form params and sets the urlencoded string into the headers for later use. I had to go down this route because for requests of type application/x-www-form-urlencoded, only…
Thuita Wachira
  • 176
  • 2
  • 16
-1
votes
2 answers

Is it better to user const = require(); or import '' from ''; If yes, could you show me?

It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code; please add some more details.It looks like your post is mostly code;…