cojs / co-body

Parse request bodies with co
MIT License
325 stars 42 forks source link

Unsupported content-type: text/plain with encoidng = null #62

Closed fredyx701 closed 6 years ago

fredyx701 commented 6 years ago

version 5.1.1 When reciveing protobuf data with co-body module we find it always return String data with unreadable code. The code in this module

 opts.encoding = opts.encoding || 'utf8';

The default “opts.encoding utf8” overwrite my input options ''opts.encoding = null". The module "raw-body“ required in this module supported “encoding = null” and will return Buffer data.

Here is my suggest

 opts.encoding = opts.encoding || (opts.encoding === null ? null : 'utf8');

Thanks