for data sent jQ (-vsdoc.js version) says this :
5074# // Set the correct header, if data is being sent
5075# if ( s.data )
5076# xhr.setRequestHeader("Content-Type",
s.contentType);
before actually sending.
jQ does not set "Content-Length" specificaly. This is the job of
XmlHttpRequest.
It is not clear from your message if you have tested this using IE or
C ?
Although, in my book this is users/callers error: one should not
"POST" with no data, me thinks ;o)
But if you think there is some logic in that you can simply do :
$.ajax({
'url' : 'foo.php',
'data' : (! myData ? "" : myData) ,
'type' : 'POST',
'dataType' : 'json',
'success' : function(j) {
// whatever
}
});
Which might work since jQ does not check if user is sending empty
string as data.
4958# // convert data if not already a string
4959# if ( s.data && s.processData && typeof s.data !== "string" )
4960# s.data = jQuery.param(s.data);
(same ...-vsdoc.js version )
-- DBJ
On Apr 14, 4:21 pm, Rebecca Murphey <[email protected]> wrote:
> correction, the title of this should say
>
> $.ajax() WITH null data property in config object results in missing
> Content-Length header in FF3
>
> On Apr 14, 10:34 am, Rebecca <[email protected]> wrote:
>
> > Just experienced this in Firefox 3, not sure whether it is desired
> > behavior, but discussed it with a fellow dev and we think it is not.
>
> > I had an ajax request as follows:
>
> > var myData = null;
>
> > $.ajax({
> > 'url' : 'foo.php',
> > 'data' : myData,
> > 'type' : 'POST',
> > 'dataType' : 'json',
> > 'success' : function(j) {
> > // whatever
> > }
>
> > });
>
> > Client was reporting a 411 HTTP response code on the request -- their
> > proxy was expecting a Content-Length header on the request, and wasn't
> > getting one. This also occurred if myData was undefined. It did *not*
> > occur when myData was {}.
>
> > We hadn't detected this error internally because our requests weren't
> > proxy'd. It seems Content-Length "should" always be there
>
> >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13
>
> > and should be 0 if myData is null or undefined.
>
> > I'm not sure whether this is just a Firefox issue, or something that
> > jQuery should address in the spirit of abstracting away browser
> > differences?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---