microsoft / typed-rest-client

Node Rest and Http Clients with typings for use with TypeScript
Other
675 stars 118 forks source link

RestClient additionalHeaders check #96

Closed mmajcica closed 6 years ago

mmajcica commented 6 years ago

In the rest client there is a check if additional headers are specified.

https://github.com/Microsoft/typed-rest-client/blob/7186708f6f5ed96c6c5ca204405915595d5b2149/lib/RestClient.ts#L171

In case user specifies a custom Content-Type header (necessary at example in case we are using uploadStream to upload a file via mutipart/formdata standard (RFC 2388) the default one will not be added. The problem is that the check over Content-Type header is case sensitive, so if you added a content-type header, this will not be detected and used correctly.

I would suggest to use a non case sensitive check for this. If you guys do agree with me, I have a code ready and I'll request a PR.

Thanks

damccorm commented 6 years ago

That makes sense to me, if you request a PR I can approve.

mmajcica commented 6 years ago

@damccorm when can I expect to see this in a package on npmjs as it will make my code cleaner?

Thanks

damccorm commented 6 years ago

@bryanmacfarlane can we release 1.0.11?

bryanmacfarlane commented 6 years ago

sure

bryanmacfarlane commented 6 years ago

done

damccorm commented 6 years ago

Thanks!