Re: XHR setting headers

On Thu, Apr 17, 2008 at 6:31 AM, Julian Reschke <julian.reschke@gmx.de> wrote:
>
> Peter Michaux wrote:

[snip]

> > 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.
> >
>
>  The whole "append" semantics is problematic as long as the user can't find
> out what the current value is.
>
>  IMHO we need either removeRequestHeader(), getRequestHeader(), or both.

These would certainly be nice additions in combination with having
blank headers after the XHR object's open() is called.

Without complete control over the headers there is no way to use the
HTTP protocol as it was intended. Hacks/workarounds must be employed.
In my situation, here I cannot control the Accept header,  I need to
either add a header like X-Accept or I need to use a parameter in the
URL like "/some/page.json" or "/some/page?format=json".

Peter

Received on Friday, 18 April 2008 03:12:15 UTC