Opened 14 years ago
Closed 13 years ago
#2518 closed defect (fixed)
xdomain doesn't parse io.bind result if content-type contains additional attributes
Reported by: | stenduncan | Owned by: | James Burke |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | IO | Version: | 0.4.1 |
Keywords: | XhrIframeProxy, xdomain, response | Cc: | [email protected]… |
Blocked By: | Blocking: |
Description
Using XhrIframeProxy? to do cross-domain server calls. The server response has a header that looks like:
Content-Type: text/xml;charset=UTF-8
This works just fine in a non-xdomain situation. But using the XhrIframeProxy? I get an error. The problem is in the method
receive: function(/*String*/stateId, /*String*/urlEncodedData)
...
Fix responseXML. var contentType = facade.getResponseHeader("Content-Type");
if(contentType && (contentType == "application/xml" contentType == "text/xml")){
facade.responseXML = dojo.dom.createDocumentFromText(response.responseText, contentType);
}
====
Notice that there is an exact query for content-type which won't match my content-type header.
I have written a brain-dead workaround that I call in my own javascript to repair the problem before I process the result in my handler method (passing in evt from the handler call which has "type, data, evt"):
fixResponseXML: function(response) {
anything to fix? if (response.responseXML != null) {
return;
};
var bIsXML = false; var contentType = response.getResponseHeader("Content-Type"); var ct = ""; var ctValues = contentType.split(";"); for (var i=0; i<ctValues.length;i++) {
if (ctValues[i] == "application/xml" ctValues[i] == "text/xml" ) { ct = ctValues[i]; bIsXML = true; break;
};
};
if (bIsXML == false) {
return;
};
if(response.responseText){
Fix responseXML. response.responseXML = dojo.dom.createDocumentFromText(response.responseText, ct);
};
}
But it seems to me that the XhrIframeProxy? should be doing this check itself and returning the correct xml in the evt.responseXML object.
Change History (2)
comment:1 Changed 13 years ago by
Milestone: | → 1.1 |
---|---|
Owner: | changed from alex to James Burke |
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [11911]) Fixes #2518. Allow for content types with charset values to be parsed for XML.