I am calling a 3rd Party API in Servant which doesn't specify a content-type header in the response. The response is just a line of text. Servant is failing to parse this response and throwing error response.
What would be the best way to either convert this to a Text or a defined type?
When a servant client processes a response with no
Content-Typeheader, it treats it likeContent-Type: application/octet-stream. To accept this content type, your API endpoint should useOctetStream, instead ofPlainText, for the list of accepted content types.So, your endpoint should look something like this:
and your handler can return the raw
ByteString: