[XHR] Default Content-Type

Hi!

  Here is what the current XHR draft says about Content-Type of the 
request:

> Scripts should specify the Content-Type header via setRequestHeader 
before invoking
> send() with an argument.

  Is invoking send() without an argument really a special case where 
scripts do not need to use setRequestHeader()? I'm pretty sure that many 
servers will look at Content-Type first, and reject a request if it's 
incorrect, even if there is no data.

> If the argument to send() is a Document and no Content-Type
> header has been set user agents must set it to application/xml for XML 
documents and
> to the most appropriate media type for other documents (using 
intrinsic knowledge about
> the document).

  What are the examples of how this intrinsic knowledge can be used? It 
is not clear how to achieve interoperability here without a precise list 
of cases. Also, what is the default Content-Type for string arguments?

  Firefox just defaults to "application/xml" for any data 
<http://lxr.mozilla.org/seamonkey/source/content/base/src/nsXMLHttpRequest.cpp#1616>, 
and so do nightly builds of WebKit.

- WBR, Alexey Proskuryakov.

Received on Saturday, 17 March 2007 07:18:48 UTC