Skip to content

koa2.x ctx.request.body === 'string' 而是object #29

@ihellodays

Description

@ihellodays

if (ctx.request.body && typeof ctx.request.body === 'string') {
xml = ctx.request.body;
} else {
// 取原始数据
xml = await getRawBody(ctx.req, {
length: ctx.request.length,
limit: '1mb',
encoding: ctx.request.charset || 'utf-8'
});
}

在koa2.0下用的时候

ctx.request.body === 'string'

这个不是string
而是 object

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