WebApi: Unable to set Content-Type header via parameter
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-01-19 12:36 AM
I am able to set other custom headers to the parameters passed into a webapi using [parameter name] or to be more specific my parameter is named "content type" so [content type].
However when I attempt to set the header Content-Type it takes this value as a literal string and in fiddler I see:
POST https://example.com/rest/integration HTTP/1.1
Content-Type: [content type]
kaiser-header: application/json
Authorization: Basic YWRtaW4udefsXNlcjmVlZHRvYWRtaW5pc3Rlcg==
Host: example.com
Content-Length: 15
{"blah":"blah"}
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-01-19 12:52 AM
There to be a bug in the current WebAPI that does not allow dynamic assignment of special reserved HTTP headers such as “Host”, “Content-Type”, etc.
