Bug Tracker

Opened 14 years ago

Closed 14 years ago

#4664 closed bug (duplicate)

$.ajax() WITH null data property in config object results in missing Content-Length header in FF3

Reported by: rmurphey Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


(See the full thread at http://groups.google.com/group/jquery-dev/browse_thread/thread/fe76bdc97c6f727b/c178b67e55b2d3d6?lnk=gst&q=length)

I had an ajax request as follows:

var myData = null;

  '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


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?

Change History (1)

comment:1 Changed 14 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Dup of #4044.

Note: See TracTickets for help on using tickets.