- From: Anne van Kesteren <annevk@opera.com>
- Date: Mon, 12 May 2008 17:06:23 +0200
- To: "Peter Michaux" <petermichaux@gmail.com>, public-webapi@w3.org
On Thu, 17 Apr 2008 01:49:44 +0200, Peter Michaux <petermichaux@gmail.com> wrote: > The XMLHttpRequest spec says "The setRequestHeader() method appends a > value if the HTTP header given as argument is already part of the list > of request headers." > This is fine but what is a problem is whether or not a new > XHMHttpRequest object has any default headers. I was trying to use the > Accept header a few days ago and I wanted to have only > > Accept: application/json > > but Opera has a default header > > Accept: text/html, text/xhtml, etc > > so my application/json was appended to the front of that list which > makes my Accept header useless as part of the client-server > communication. The server thinks that the client knows what to do with > text/html. My JavaScript certainly does NOT know what to do with > text/html. My JavaScript only knows how to handle application/json. That seems like a problem with Opera. Have you filed a bug report? https://bugs.opera.com/wizard/ > I think all XMLHttpRequest headers should be specified as blank when > the object is created. Then the JavaScript can add any headers it > needs to add. If, when the call to send() occurs, some essential > header(s) is missing the XHMLHttpRequest object should add these > automatically but only according to specified behavior. In general this should already be the case, but for some headers it would pose security or privacy issues if they were allowed to be set by the author. In any case, for Accept this was never an issue with the specification. -- Anne van Kesteren <http://annevankesteren.nl/> <http://www.opera.com/>
Received on Monday, 12 May 2008 15:06:59 UTC