iron-ajax icon indicating copy to clipboard operation
iron-ajax copied to clipboard

handle-as:'xml' results in warning from xhr.responseType

Open tomvantilburg opened this issue 9 years ago • 16 comments

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.

tomvantilburg avatar Jun 08 '15 15:06 tomvantilburg

Thanks for reporting! This is definitely our fault. Can you confirm which browser(s) you see this warning in?

cdata avatar Jun 08 '15 16:06 cdata

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.

tomvantilburg avatar Jun 08 '15 17:06 tomvantilburg

Yeah I am getting the same issue - saying its not part of the below enum

enum XMLHttpRequestResponseType {
  "",
  "arraybuffer",
  "blob",
  "document",
  "json",
  "text"
};

AaronLayton avatar Dec 08 '15 14:12 AaronLayton

+1

chriswalz avatar Dec 30 '15 05:12 chriswalz

@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

AaronLayton avatar Dec 30 '15 21:12 AaronLayton

@cdata @rictic ping to take a look.

ebidel avatar Jan 11 '16 16:01 ebidel

Any update?

AaronLayton avatar Jan 26 '16 13:01 AaronLayton

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?

fjfeijoo avatar Mar 31 '16 09:03 fjfeijoo

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

AaronLayton avatar Mar 31 '16 10:03 AaronLayton

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 ?

rubenflorez avatar Oct 26 '16 22:10 rubenflorez

Same with me Polymer 1.7 and Chrome 54.0.2840.71

JoergHerbarth avatar Oct 28 '16 07:10 JoergHerbarth

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.

wburgers avatar Oct 28 '16 08:10 wburgers

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.

cashpipeplusplus avatar Nov 25 '16 03:11 cashpipeplusplus

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.

akc42 avatar Dec 11 '16 21:12 akc42

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.

DCUnit711 avatar Apr 21 '17 21:04 DCUnit711

@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".

cashpipeplusplus avatar Apr 24 '17 02:04 cashpipeplusplus