- From: Jarred Nicholls <jarred@webkit.org>
- Date: Tue, 10 Apr 2012 21:10:56 -0400
- To: Jonas Sicking <jonas@sicking.cc>
- Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Glenn Maynard <glenn@zewt.org>, Anne van Kesteren <annevk@opera.com>, public-webapps@w3.org
- Message-ID: <CANufG2OGy0wzM8Uc=nTmCBsCMjghxjykamZGSQuvH0ynUiBo1Q@mail.gmail.com>
On Tue, Apr 10, 2012 at 9:00 PM, Jonas Sicking <jonas@sicking.cc> wrote: > On Tue, Apr 10, 2012 at 4:15 PM, Jonas Sicking <jonas@sicking.cc> wrote: > > On Tue, Apr 10, 2012 at 4:11 PM, Tab Atkins Jr. <jackalmage@gmail.com> > wrote: > >> On Tue, Apr 10, 2012 at 3:58 PM, Glenn Maynard <glenn@zewt.org> wrote: > >>> On Tue, Apr 10, 2012 at 5:50 PM, Jonas Sicking <jonas@sicking.cc> > wrote: > >>>> Is it more surprising than that > >>>> > >>>> xhr.send(hasSomethingToSend() ? getTheThingToSend() : ""); > >>>> > >>>> sets the Content-Type header even when no body is submitted? > >>> > >>> That's exactly what I would expect. A body that happens to have a zero > >>> length is still valid text/plain data. > > > > I'm not sure everyone is sharing that expectation. > > > >>> If you want to omit Content-Type in the above case, then you should > write: > >>> > >>> xhr.send(hasSomethingToSend() ? getTheThingToSend() : null); > >> > >> Or, of course: > >> > >> if(hasSomethingToSend()) > >> xhr.send(getTheThingToSend()); > > > > That isn't terribly useful if you're trying to get a response... > > > > If I'm the only one who prefer the other behavior then we should stick > > to what the spec already says. I'll make sure Gecko maintains that > > behavior as we implement our new WebIDL bindings. > > I got the following feedback from the WebIDL implementers: > > One note, though. If we do want the current behavior, then I think > that it would make sense to change the IDL for send() to: > > void send(ArrayBuffer data); > void send(Blob data); > void send(Document data); > void send(optional DOMString? data = null); > void send(FormData data); > > and change the text that currently says "If the data argument has been > omitted or is null" to "If the data argument is null". That will make > it much clearer to someone reading the IDL that passing nothing has > the same behavior as passing null. > > / Jonas > > This makes sense. I too am of the opinion that "" is text/plain even if empty and ought to be distinguishable. However I can see your point Jonas since "" is falsy.
Received on Wednesday, 11 April 2012 01:11:46 UTC