cujojs / rest

RESTful HTTP client for JavaScript
http://cujojs.com/
Other
1k stars 146 forks source link

Avoid setting the request Content-Type unless there is an entity #144

Closed scothis closed 8 years ago

scothis commented 8 years ago

Setting the Content-Type on a cross-origin request can trigger a CORS preflight request depending on the value being set. Best case it adds extra latency, worst case, the server either doesn't know how to handle the request or rejects the request.

Since there is no purpose for a Content-Type without an entity, we can skip the header.

Issue: #128