-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request pending forever if content type is application/json #154
Comments
Can you confirm that the koa-router example works for you? We have the same basic setup. https://github.com/dlau/koa-body/blob/master/examples/koa-router.js |
Yes, I'm using it in other routes with other content types and it works it also work on that one if I change the content type. I just add the koa-router.js example to my project and it also works fine |
I don't think we'll be able to troubleshoot this without an example repository. |
I can confirm we're experiencing this as well, but I should note that this only happens when we deploy to Google Cloud Functions, running locally works fine. Reproducing this is pretty simple: const koa = require("koa");
const koaBody = require("koa-body");
const KoaRouter = require("koa-router");
const app = new koa();
app.use(koaBody({ multipart: true }));
const router = new KoaRouter();
router.post("/", ctx => {
ctx.body = ctx.request.body;
});
app.use(router.routes());
if (process.env.NODE_ENV !== "production") {
app.listen(3222);
}
exports.callback = app.callback(); In postman if you enable the header |
Decided to spend some time and dig into this and was able to replicate it on the functions emulator. Looks to be an issue with the stream-utils/raw-body#57 Not sure what the solution is here though to actually get |
Same issue |
Same issue. |
Problem/Feature Request Summary
Not able to parse request body when the header is application/json
Environment Information
Current Behavior
When request Content-Type header is application/json the request stay pending forever resolving. ,
Steps to Reproduce
const Router = require("koa-router");
const koaBody = require("koa-body")
Expected Behavior
application/json content parsed
Context (Environment)
For urlencoded or text request its working fine.
I tried to debug it and I can see the options passed to the co-body json https://github.com/dlau/koa-body/blob/ed81445ccd6d2e3b5e4605ce502b60c75386f8f5/index.js#L74 are:
The text was updated successfully, but these errors were encountered: