koajs / bodyparser

Koa body parsing middleware
MIT License
1.31k stars 116 forks source link

Parse body with no content type? #106

Closed uLan08 closed 6 years ago

uLan08 commented 6 years ago

I formerly used koa-json-body but I had the need of disabling the body parser on a certain route. All of the things I tried to skip the middleware didn't work and in which resulted to me using this package. Problem now is my client currently does not set a content-type header but koa-json-body was able to handle that. Is there a way I could achieve that using this package?

uLan08 commented 6 years ago
.use(bodyParser({
    extendTypes: {
        json: ['text', 'text/plain']
    }
}))

Did the trick. But please do tell if there's a better way.