The below requests always takes the default Content Type irrespective of what I am setting. I set to application/xml, but still it goes as application/json. This problem however is not there when I invoke the service via Postman.
Set objHTTPRequest=##class(%Net.HttpRequest).%New()
Set objHTTPResponse=##class(%Net.HttpResponse).%New()
Do objHTTPRequest.SetHeader("Authorization", "username:password")
Do objHTTPRequest.SetHeader("Content-Type", "application/xml")
Do objHTTPRequest.Send("GET","url")
Set Op=objHTTPRequest.HttpResponse.Data.Read()
zw objHTTPRequest -> No Content-Type Set
How did you check that default Content-Type?
Maybe you missed something about how HTTP really works?
When you send some data with
POSTorPUTrequest, you can set Content-Type for this data. If you want to retrieve some data from the server in the format which you want, you can set headerAccept, but when you set this header, it does not mean, that you really get this data in the asked format, it only depends on the realization of this particular server. To some examples.