Hi
I am consuming REST API with two way SSL so I am using OnBeforeRequestAdvanced to send certificate.
This API contains two methods one is working fine.
But for other I am getting "Unsupported Media Type" error, when I checked the logs the Content-Type
value is "application/json; charset=UTF-8" but I am only passing "application/json".
How can I remove this charset=UTF-8 from Content-Type?
I can't use OnBeforeRequest to customize it because I am already using OnBeforeRequestAdvanced to send certificate.
Can someone help me?
Kind Regards,
Rahul
Hi Rahul,
You'll need to do that in an Extension Action as well. You can use RestRequest.GetCurrent().GetHttpRequest() to get the HttpRequest, which has a Headers collection that contains the headers. You should be able to manipulate the Content-Type header using it.
Thanks Kilian for the help.
Solved it using extension action.
Glad I could be of help Rahul, happy coding!
Can you share how you did it with the extension action?
I've tried it with this. But it doesnt seem to get removed.
request.Headers.Remove
Hello Saiful Aseem Abdul Khader
I had restrictions to create extension action, so I used below forge component
Advanced REST
Regards