W3C home > Mailing lists > Public > public-webapi@w3.org > May 2006

Re: handling of POST in XMLHTTPRequest.

From: Mark Baker <distobj@acm.org>
Date: Wed, 3 May 2006 14:08:26 -0700
Message-ID: <c70bc85d0605031408o1c4a8408s3909f5ee94365455@mail.gmail.com>
To: "David.Carson@nokia.com" <David.Carson@nokia.com>
Cc: public-webapi@w3.org

David,

On 5/3/06, David.Carson@nokia.com <David.Carson@nokia.com> wrote:
>
> Hi All,
> We have recently run into a case where XMLHTTPRequest is being used to
> POST content, but the javascript author has failed to add the mandatory
> content-type header.

It's not mandatory from an HTTP POV.  Certainly desirable, but not mandatory.

> We were wondering what the default content type
> should be. We believe that it should be the same default as the default
> content type for a FORM post.

I don't think a default is desirable, unless it can be shown that
effectively all existing apps which don't provide a Content-Type, use
the same format.  Otherwise, the HTTP message would be "lying" about
its meaning, and that could break existing apps.

> Oddly enough, the w3 draft spec for xmlhttprequest does not even state
> that you should provide a content-type when posting:
> http://www.w3.org/TR/XMLHttpRequest/#dfn-send
> whereas XULPlanet at least states one should be provided:
> http://www.xulplanet.com/references/objref/XMLHttpRequest.html#method_se
> nd
> "The MIME type of the stream should be specified by setting the Content-
> Type header via the setRequestHeader method before calling send."
> neither say what the default should be.

That sounds like good advice to me.  Any objections?

Mark.
Received on Wednesday, 3 May 2006 21:08:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:55 GMT