Project: SWT
Bug 332259 [Browser] Post requests always uses application/x-www-form-urlencoded content-type
Reported: 2010-12-09 17:42:43 | Status: resolved fixed

I am trying to use the SWT browser to talk to a webserver that is expecting application/json content. However, when I 'post' data (using the browser API setURL(String, String, String[])) method, it *always* sets my content-type to application/x-www-form-urlencoded. Even if I specify a different content-type in the headers field, it gets replaced with application/x-www-form-urlencoded. This is happening in both Mozilla and Webkit (on Linux/GTK), I don't know about other platforms. It appears that both browser implementations will always set this field regardless of what other headers are set. Maybe we can check if these fields are already set, and use the existing values if so. (This appears to be the same for content-length too, although that's likely not as serious).

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT Mozilla/common/org/eclipse/swt/browser/Mozilla.java bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java