#1061 new
ronin-16982 (at lighthouseapp)

Ajax.Request: Content-type header shouldn't be set if there is none

Reported by ronin-16982 (at lighthouseapp) | May 20th, 2010 @ 06:39 PM

If contentType is set to null in the options for Ajax.Request, it should not set the Content-type header.
Right now, if contentType is set to null explicitly in the options, 'null' will be set as Content-type.

This leads to trouble when using Ajax.Request to send FormData objects (with multi-part data) in WebKit.
WebKit only sets the correct Content-type (including the needed multi-part boundary) if there's not one set already.
See http://trac.webkit.org/browser/trunk/WebCore/xml/XMLHttpRequest.cpp, void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec)

I've only confirmed the same behavior for Firefox Nightly builds, but didn't have a look at their code. I didn't verify it for other browsers yet. However, it makes sense to me to not set the Content-type to 'null' anyway.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins