iron-ajax
iron-ajax copied to clipboard
Explicitly document that body attr will be ignored when method is GET or HEAD
Since iron-ajax / -request simply proxy down to XHR, even if a body attribute is set, it will simply be ignored, and not sent with the request. This isn't indicated very clearly in the docs for the body attribute.
Ref in spec https://xhr.spec.whatwg.org/#the-send()-method
Hm, my intuition is that if we documented everything that iron-ajax did, the documentation would be as long as the spec itself! OTOH this is a fairly reasonable thing to document. I'd accept a PR documenting this.
On a related note, it looks like the fetch
API won't fix this either, though it will at least give a useful error message rather than silently setting body
to null
. See step 31 here: https://fetch.spec.whatwg.org/#request-class