Re: setRequestHeader / Accept

On May 25, 2008, at 11:06 PM, Julian Reschke wrote:

> Maciej Stachowiak wrote:
>> Treating null as empty string here may be sensible (no strong  
>> opinion either way) but removing the header when set to empty seems  
>> wrong. If header removal is really essential we should add a method  
>> for it.
>
> In HTTP, absence of a header is different from having an empty value.
>
> I can understand the argument that set(..., null) is the wrong way  
> to remove a value.

Good!

> But if it doesn't, it shouldn't do anything that a non-null argument  
> would do.

Why not? In nearly every JS API that takes a string, the JS value null  
is either treated the same as the empty string, or the same as the  
string "null".

> So yes, an explicit way to remove an header would be good. Otherwise  
> we'll see broken requests on the wire (as just seen in the example I  
> cited a few days ago).

I am ok with deferring such a mechanism to XHR2 however. In WebKit  
we'll likely implement it equally quickly whether it is in XHR1 or  
XHR2 since it seems like useful functionality. But there are  
complications, namely, how does it interact with headers that are set  
automatically by the UA?

Regards,
Maciej

Received on Monday, 26 May 2008 08:01:10 UTC