How can I force a content type on the response?

Viewed 54

I use an API which returns text/plain for its content type even though it's actually application/xml (XML format). If I change the content type dropdown in Postman to XML, it displays in the "Pretty" tab properly.

I have also tried setting Accept to application/xml but the API still returns the document as text/plain.

Since the API doesn't return the correct Content-Type header, how can I force Postman to show it as if it were application/xml?

I thought a Pre-request Script might work? But I am new to Postman scripting and have not discovered an answer by Googling around.

1 Answers

Add the following as a header, when you send your request:

Determine what type of representation is desired on the client-side, an HTTP header ACCEPT is used

Key Value
Accept application/xml

Read the following: REST API Content Negotiation

Related