davetemplin / web-request

Simplifies making web requests with TypeScript async/await
MIT License
35 stars 8 forks source link

Added `null` as a valid value for RequestOptions.encoding #8

Closed maghis closed 8 years ago

maghis commented 8 years ago

Current "master" fails if encoding: null compiling with TS2.0 with --strictNullChecks (? optional allows only undefined, not null).

When encoding is null, request returns a binary response (content is a Buffer): marking the field only as optional with ? allows undefined - which means utf8 - but not for null (explained in https://github.com/request/request/blob/master/README.md#requestoptions-callback look for encoding).