Re: [XHR] XMLHttpRequest.send("")

On Tue, Apr 10, 2012 at 3:42 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> On Tue, Apr 10, 2012 at 3:37 PM, Glenn Maynard <glenn@zewt.org> wrote:
>> On Tue, Apr 10, 2012 at 5:21 PM, Anne van Kesteren <annevk@opera.com> wrote:
>>>
>>> On Wed, 11 Apr 2012 00:08:47 +0200, Jonas Sicking <jonas@sicking.cc>
>>> wrote:
>>>>
>>>> Is this intentional?
>>>>
>>>> This does match what Gecko does, but we are willing to change this if
>>>> others agree that it's a better behavior.
>>>
>>>
>>> Yes, the idea is that you can transmit both the empty entity body and no
>>> entity body. The former will also have a Content-Length header set. Whether
>>> it is useful to have both...
>>
>> I'd find it very surprising if send(getSomeString()) resulted in a different
>> Content-Type depending on the length of the string.  A zero-length string is
>> still a string.
>
> Is it more surprising than that .send() and .send(hasSomethingToSend()
> ? getTheThingToSend() : "") sets a Content-Type even when no body is
> submitted?

Err.. sorry, that should say:

Is it more surprising than that

xhr.send(hasSomethingToSend() ? getTheThingToSend() : "");

sets the Content-Type header even when no body is submitted?

/ Jonas

Received on Tuesday, 10 April 2012 22:51:18 UTC