Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpClient.GetAsync() does not return a response #46

Closed
odimond opened this issue Jun 22, 2017 · 5 comments
Closed

HttpClient.GetAsync() does not return a response #46

odimond opened this issue Jun 22, 2017 · 5 comments

Comments

@odimond
Copy link

odimond commented Jun 22, 2017

Hi HoloJS,

We have an existing application that uses ThreeJS in the browser and requests JSON from a server using XmlHttpRequest (inside THREE.FileLoader) which I am trying to get running in HoloJS.

In HoloJsHost.XmlHttpRequest.DownloadAsync() the HttpClient.GetAsync() method sends the request to the server. I can see in the server's console that the request comes through and the JSON is produced, however I never get either a success or failure response message.

Thanks.

@bryanbocao
Copy link

How about this issue #48 ?

@Almost-Done
Copy link
Member

I'll take a look at this in the next couple of days. Does it sometimes work to download the JSON or is it 100% not working?

@Reda-S
Copy link

Reda-S commented Jun 27, 2017

Hi Odimond,
For some reason it isn't recognizing a JSON file to be of type text (xhr->IsTextResponse() is returning false)So this is a temporary fix: just Change the following code of "XmlHttpRequest.js"
from
Object.defineProperty(this, "response", {
get: function () {
return nativeInterface.xhr.getResponse(this.native);
}
to
Object.defineProperty(this, "response", {
get: function () {
return nativeInterface.xhr.getResponseText(this.native);
}

@Almost-Done
Copy link
Member

Thank you @Reda-S for debugging this.

Indeed XMLHttpRequest.response should return text if the request type is text. I fixed the native implementation of XmlHttpRequest to not fail in getResponse if the request type is text and instead return the text.

@Almost-Done
Copy link
Member

The fix is in master. Please re-open the issue if you encounter it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants