Last post Dec 11, 2009 08:46 PM by James Osborne - MSFT
Dec 05, 2009 05:36 AM|habibs|LINK
Hi, i am having a problem with some J2ME clients where they send multiple Content-Type HTTP headers which results to "400 Bad Request" on my REST service (developed with WCF Rest Starter Kit) . Is there any way to capture request before processing and remove
one of headers ?
here is request info from http sniffer:
content-type: application/json; charset=utf-8
User-Agent: Nokia6233/2.0 (03.70) Profile/MIDP-2.0 Configuration/CLDC-1.1 UNTRUSTED/1.0
HTTP/1.1 400 Bad Request
Date: Sun, 29 Nov 2009 08:19:20 GMT
<h1>Bad Request (Invalid Header Name)</h1>
Dec 11, 2009 08:46 PM|James Osborne - MSFT|LINK
You would have to intercept the message before it gets to the WCF layer, I think. This is a violation of the Http spec, because it doesn't make sense to have two different content types. You can have multiple accept headers, or any header can be duplicated
if its values can be combined in a comma separated list. Content-Type can't do that.