opened
dasa
username_0
`esri/request` won't return xml when "handleAs" is "xml" unless the response Content-Type header is either "text/xml" or "application/xml".

Reference: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML

Example code:

```java
// Most of the new ms documents have content type as application/vnd.openxmlformats-*, we need to set these correctly
// For rest of the xml formats, convert them to text/xml, need to be very careful on this
String contentType = con.getContentType();
if (contentType != null && contentType.contains("xml") && !contentType.contains("vnd.openxmlformats")) {
	response.setContentType("text/xml");
}
else {
	response.setContentType(contentType);
}
```
Normalize xml response content type
issue
created
bsvensson
username_1
Is this a problem with the proxy or esri/request?  

Looking at the [HTTP spec](https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17) it doesn't seem that sending two Content-Type headers are legal. So, as far as I understand, this means that in this case we would have to overwrite the Content-Type.

Would changing the Content-Type from a vendor-specific one `vnd.openxmlformats*` to a generic `application\xml` always be a good thing?  Or should it be something configurable in the proxy?

Vendor specific content types are registered with [IANA](https://www.iana.org/assignments/media-types/media-types.xhtml).
comment
created
dasa
username_0
👍
comment
created
dasa
username_0
`esri/request` is relying on dojo which is relying on the behavior of `XMLHttpRequest`. This could be changed and this could be made a configurable option in the proxy.
comment
created
bsvensson
username_1
Fixed in all three proxies.  @username_0 - can you test?
comment
created
bsvensson
username_1
@username_0 - I installed a better fix now that I understand the problem better.

Any WMG OGC servers that use `application/vnd.ogc.wms_xml` will now have their content-type changed to `text/xml`. 

Test case:
`curl --verbose  "http://localhost/resource-proxy/DotNet/proxy.ashx?http://data.wien.gv.at/daten/wms?SERVICE=WMS&REQUEST=GetCapabilities"`
comment
created
dasa
username_0
👍 for PHP
comment
closed
bsvensson
username_1
issue