iron-ajax icon indicating copy to clipboard operation
iron-ajax copied to clipboard

Explicitly document that body attr will be ignored when method is GET or HEAD

Open jonvuri opened this issue 9 years ago • 2 comments

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.

jonvuri avatar Feb 18 '16 19:02 jonvuri

Ref in spec https://xhr.spec.whatwg.org/#the-send()-method

jonvuri avatar Feb 18 '16 19:02 jonvuri

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

rictic avatar Feb 18 '16 19:02 rictic