Closed ralyodio closed 7 years ago
My fault. Didn't define the content-type from Postman for "raw":
https://i.imgur.com/tKyEVnA.png
The default "text" was override my manual headers.
i have meet with it too. u should set request header correctly which means 'Content-Type' is equal to 'application/json'.
I added the content-type header, but it didn't work
i have meet too, i add koa-bodyparser
I have the exact same issue. I'm using koa-body, and my request has the header content-type: application/json
, yet the ctx.request.body
is empty...
When I POST to my endpoint with a JSON body its not showing up on the server:
I get undefined for
ctx.request.body
sending as form data seems to be ok for non-json objects. but I want to post json.
I've tried posting with both
application/javascript
andapplication/json
neither work. (i'm using"koa-bodyparser": "^3.2.0"
with"koa": "^2.0.0",
)Here is relevant app.js: