Skip to content

Conversation

@tangxinfa
Copy link

by sync listen events on ctx.req, multiple body parser coexist is safe.

json parser's returnRawBody option can provide untouched request body,
we can use it to do signature validation if required,
but co-body commonly use by high level middlewares,
and not expose a option for user to customize.

allow multiple body parser coexist is a more elegant solution.

by sync listen events on ctx.req, multiple body parser coexist is safe.

json parser's returnRawBody option can provide untouched request body,
we can use it to do signature validation if required,
but co-body commonly use by high level middlewares,
and not expose a option for user to customize.

allow multiple body parser coexist is a more elegant solution.
lib/form.js Outdated
.then(function() {
return raw(inflate(req), opts);
})
return raw(inflate(req), opts)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think why we write this code is becaulse inflate will throw in some situation, so we need to wrap it in a promise chain.

test/any.js Outdated
var app = koa();

app.use(function *(next){
this.request.textParser = parse.text(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we just check the content-type before call parse[method]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants