angular/angular.js — pull request #4021 by jroper (2013-09-17 04:28:14+00:00)
Title: Don't send empty String in place of no body

XMLHttpRequest.send spec defines different semantics for an empty string as compared to null, any string, whether empty or not, should be sent with a Content-Type of text/plain, whereas null should have no Content-Type header set. Since the user hasn't passed in content to send, the latter should be used.

See http://www.w3.org/TR/XMLHttpRequest/#the-send()-method

Combined with this bug in WebKit based browsers:

https://code.google.com/p/chromium/issues/detail?id=172802

This means when no body is supplied, the `Content-Type` ends up being application/xml, which for an empty String, means the body is invalid according to the content type. This causes issues for web servers that automatically parse the body according to the declared content type, such as this issue in Play framework:

https://github.com/playframework/playframework/issues/1676