277
Views
5
Comments
Solved
Remove charset=UTF-8 from Content-Type of REST API call (Unsupported Media Type)
Application Type
Reactive
Service Studio Version
11.53.39 (Build 61952)

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


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

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.

2026-03-06 09-21-20
Rahul Chavan

Thanks Kilian for the help. 

Solved it using extension action.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Glad I could be of help Rahul, happy coding!

UserImage.jpg
Saiful Aseem Abdul Khader

Hi Rahul,


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

2026-03-06 09-21-20
Rahul Chavan

Hello Saiful Aseem Abdul Khader 

I had restrictions to create extension action, so I used below forge component 

 Advanced REST 


Regards

Rahul



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.