Skip to content

Please check if body has already been bound to ctx.request before parsing the raw body. #115

@LvChengbin

Description

@LvChengbin

Just like the code in koa-bodyparser https://github.com/koajs/bodyparser/blob/master/index.js#L72

 return async function bodyParser(ctx, next) {
    if (ctx.request.body !== undefined) return await next();
    if (ctx.disableBodyParser) return await next();
}

Without checking it, koa-body will make requests be pending there if the raw body has already been parsed by other middleware because the Promise cannot be resolved in https://github.com/dlau/koa-body/blob/master/index.js#L84

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions