aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

Http get fails in Firefox but works in Chrome etc. #129

Closed owenellis closed 8 years ago

owenellis commented 8 years ago

I have a get that looks like this:

return this.http.get(urlevent) .then(response => { this.events = response.content; })

response.content returns this in Firefox:

2016 Inaugural1

Which then results in this error:

Stack trace: Error: Value for 'events' is non-repeatable itemsChanged@webpack:pensive://./~/aurelia-templating-resources/dist/commonjs/repeat.js?:141:1

In Chrome, IE etc. response.content returns an array of objects which can be used in the repeat.for without an issue.

I changed to use the fetch client like this:

return this.http.fetch(urlevent) .then(response => response.json()) .then(data => { this.events = data; })

and did not receive any error in Firefox so it appears to only be an issue with http-client.

owenellis commented 8 years ago

Is it possible to get some response to issues posted here?

I don't want to change all my requests to use the fetch client but if nothing is going to be done to resolve the issue in Firefox then I would at least like to have confirmation.

EisenbergEffect commented 8 years ago

This library isn't our priority right now because Fetch is the way forward and is critical for the future of web development. We are happy to fix issues on this library, but it's more likely to happen if the community digs in and submits a pull request to us.

owenellis commented 8 years ago

Thanks for the response, that is exactly what I needed to know. With Fetch being the way forward I will make the change now to existing code and use it in the future.

EisenbergEffect commented 8 years ago

Closing this since there was no PR or any further reports of issues like this.

miguelsan commented 8 years ago

This issue still exists. I am trying to connect to an XML (not JSON) API, and I need to parse the response into an object, thus:

new HttpClient()
  .configure(config => { config.withResponseType('xml') })
  .get(myurl)
  .then(response => { this.items = this.parseXML(response.content); });

where the parseXML function returns an array. But I get

ERROR [app-router] Error: Value for 'items' is non-repeatable

both with http_client and with fetch_client. In the end this means for me that Aurelia in its current state is incapable of anything but JSON, which is quite an issue. Tried with FF and Chrome.