iron-ajax
iron-ajax copied to clipboard
handle-as:'xml' results in warning from xhr.responseType
When setting handle-as: 'xml', the response is correctly identified as XML but the xhr.responseType expects 'text' instead of 'xml' at 203:
xhr.responseType = xhr._responseType = (options.handleAs || 'text');
This results in the warning:
The provided value 'xml' is not a valid enum value of interface XMLHttpRequestResponseType.
Thanks for reporting! This is definitely our fault. Can you confirm which browser(s) you see this warning in?
I can confirm in: Chrome 43.0.2357.81 m Also tested with FF 38.0.5 but warning doesn't show up there. Lots of other (seemingly non related) errors overthere though so I wouldn't trust on that.
Yeah I am getting the same issue - saying its not part of the below enum
enum XMLHttpRequestResponseType {
"",
"arraybuffer",
"blob",
"document",
"json",
"text"
};
+1
@cdata @notwaldorf @rictic Any update on this issue? I'm doing a project where the API is an XML feed so would be awesome to use this without having to do some form of custom callback
@cdata @rictic ping to take a look.
Any update?
I'm in the process of learning Polymer and I'm having this issue accessing a XML service. Is there a workaround to get the xml data?
Nope still could do with a good solution or example on how to use this with XML - I have not taken a look at this in a while so not sure if there are other 3rd party components that can handle this use case
I´m using v1.7 and I´m receiving the same error: The provided value 'xml' is not a valid enum value of type XMLHttpRequestResponseType
Any news on this issue ? Any workaround ?
Same with me Polymer 1.7 and Chrome 54.0.2840.71
You can use the type "document" to read XML. The resulting object will be a nicely structured XML document. Took me a while to figure this out as well.
I have also discovered that "document" does what "xml" is documented to do. Should we just update the docs? Or should "xml" on iron-ajax be converted to "document" on XHR? I'm happy to create a PR for either.
I've just hit this same bug. I have been using json for everything and I now have a use case which requires xml. Why has it taken 18 months not to deal with it?
@tjsavage told us at the Polymer Summit that bugs were being fixed.
This is still an issue and really needs to be fixed. At the very least, edit the documentation and remove xml from the list. It can't handle it, so don't say it can.
@cdata, can you or someone else on Polymer please provide some guidance?
In https://github.com/PolymerElements/iron-ajax/issues/53#issuecomment-262875337 I offered to submit a PR to either fix the docs to change "xml" to "document" or to fix the code to convert from "xml" on iron-ajax to "document" on XHR.
Is the doc wrong, or is the behavior wrong? Please advise.
For everyone else coping with this bug, you can work around it for now by using "document" instead of "xml".