Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 332259

Summary: [Browser] Post requests always uses application/x-www-form-urlencoded content-type
Product: [Eclipse Project] Platform Reporter: Ian Bull <irbull>
Component: SWTAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: error-reports-inbox
Version: 4.1   
Target Milestone: 3.8 M3   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Ian Bull CLA 2010-12-09 17:42:43 EST
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).
Comment 1 Grant Gayed CLA 2011-10-17 15:39:38 EDT
Fixed > 20111017, patch: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=016dc8e9d43c2ce1a2b2df6c6d7ccc20e421936e .  The Mozilla and WebKitGTK implementations were the only ones that needed changes.
Comment 2 EPP Error Reports CLA 2014-11-18 08:12:09 EST
*** Bug 452090 has been marked as a duplicate of this bug. ***
Comment 3 EPP Error Reports CLA 2014-11-18 08:12:10 EST
*** Bug 452091 has been marked as a duplicate of this bug. ***
Comment 4 EPP Error Reports CLA 2014-12-15 11:47:54 EST
To date this log entry was reported 10 times.

Your friendly error reports bot.
Comment 5 EPP Error Reports CLA 2014-12-16 13:03:18 EST
To date this log entry was reported 25 times.

Your friendly error reports bot.
Comment 6 EPP Error Reports CLA 2014-12-17 10:03:59 EST
To date this log entry was reported 50 times.

Your friendly error reports bot.