martyjs / marty

A Javascript library for state management in React applications
http://martyjs.org
MIT License
1.09k stars 76 forks source link

"Failed to load response data" in chrome #90

Closed nhagen closed 9 years ago

nhagen commented 9 years ago

I narrowed it down to a line in the fetch library, but in case this isn't an issue with fetch, I'm copying here. See https://github.com/github/fetch/issues/83

Following the getting started guide here: http://martyjs.org/guides/getting-started/

npm install -g yo generator-marty
mkdir example && cd example
yo marty
yo marty:domain user
npm start
open http://localhost:5000/user/134 in chrome

Inspecting the api call to http://localhost:5000/api/users/134 yields Failed to load response data in the preview tab. When I console.log the api response, it shows {id: "4"}, which makes it seem like response body is being returned somewhere, so this might not break anything, just make debugging responses difficult.

The [Exception: DOMException: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'blob').] error described in the fetch issue is still happening, despite the response apparently coming back.

In my original issue on my own implementation, returning when returns a 404 error, but when I right click > open in new tab on the API request from the chome debugger, the request works just fine (in a new tab, by its self) and I receive the response back with no issues. Something in marty/fetch is corrupting/not returning the response.

Let me know if this is reproducible. I've tried this with node v0.10.33 and v0.11.14

nhagen commented 9 years ago

The issue with the response not going through was fixed by https://github.com/jhollingworth/marty/commit/cae1d6a3800c2ef69f70a443b3b51d229b15603b as the response object didn't have response._body, and marty was not processing the json.

npm update fixed it. My bad. I don't think the issue with chrome is related to Marty.

jhollingworth commented 9 years ago

Cool, no worries. Glad its fixed :)