Regarding the request method response content type support

I checked the docs there was mentioned requests made using the Request method supports string, JSON and XML response type.
doc link - Request Method
Does the request method support the response type of text/JSON? When I tried to call an API that returns a response of content-type text/JSON using the request method I got the below error.
Error:

{status: 415, headers: {…}, response: 'Unsupported content type', errorSource: 'APP', attempts: 1}

Is there any way to fix this issue?

You should be able to set Content-Type and Accept HTTP headers in options.headers.

const options = {
  headers: {
    "Content-Type": "text/json",
    "Accept": "text/json"
  },
  body
};

await client.request.post(url, options);

Hi @Amaresh_S_M,

Our platform supports limited content-types in the response to an HTTP request made from the platform’s Request method.
I don’t see text/json as one of the IANA’s registered MIME types for text. Which platform’s API is it that you are trying to integrate? Could you point us at the documentation link if there are any?

Could you check if application/json is supported by the same API with configuration from any request headers?

Thanks, @Raviraj We don’t have any public documentation. We are trying to integrate one of the customer’s API. Their API response content type is text/JSON.

Thanks @kaustavdm It is not working for our case.

@Amaresh_S_M I would check with the product team if the text/json content-type can be supported for the response of a request.

But, it has a less chance to be added as it is not a familiar service that other developers would also likely to use and not one of the standard registered HTTP MIME types.

Please check with the service provider if the content type can be changed to one of the supported content-type like application/json.