{"action":"created","issue":{"url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/1382","repository_url":"https://api.github.com/repos/eclipsesource/tabris-js","labels_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/1382/labels{/name}","comments_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/1382/comments","events_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/1382/events","html_url":"https://github.com/eclipsesource/tabris-js/issues/1382","id":236234064,"number":1382,"title":"Tabris.js XMLHttpRequests not accepting responses: readystate 1","user":{"login":"CooperITP","id":28659049,"avatar_url":"https://avatars1.githubusercontent.com/u/28659049?v=3","gravatar_id":"","url":"https://api.github.com/users/CooperITP","html_url":"https://github.com/CooperITP","followers_url":"https://api.github.com/users/CooperITP/followers","following_url":"https://api.github.com/users/CooperITP/following{/other_user}","gists_url":"https://api.github.com/users/CooperITP/gists{/gist_id}","starred_url":"https://api.github.com/users/CooperITP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CooperITP/subscriptions","organizations_url":"https://api.github.com/users/CooperITP/orgs","repos_url":"https://api.github.com/users/CooperITP/repos","events_url":"https://api.github.com/users/CooperITP/events{/privacy}","received_events_url":"https://api.github.com/users/CooperITP/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-06-15T15:43:51Z","updated_at":"2017-06-16T11:56:58Z","closed_at":null,"body":"### Problem description\r\n\r\nI have a tabris.js app that I needed to connect to a SQL database. In order to do so, I decided the best option would be to create an express REST API and then make XMLHttpRequests to it. When the app makes a request, the REST API shows that a GET request has been made and even responds with a result. I have tested it in a browser and found that the result is being returned flawlessly. The problem is that the readystate of the XHR never leaves 1 and therefore onload/onreadystatechange is never called. At one point I had this app working so I don't know what happened. I will include some mock REST API code and the Tabris.js code below. I should also note that the fetch API does the same thing: the REST API gets the request but the app never gets a timeout, error, or success.\r\n\r\n### Expected behavior\r\n\r\nSuccessful responses from the REST API and readyState changes from 1 to 4\r\n\r\n### Environment\r\n\r\n- Tabris.js version: 2.0.0-rc2-dev\r\n- Device: iPhone 6S\r\n- OS: iOS 10.3.3 Developer beta 3\r\n\r\n### Code snippet\r\n\r\nREST API:\r\n```javascript\r\nrouter.get('/', function(req, res) {\r\n    res.json({Mock: 'Code'})\r\n})\r\n```\r\n\r\nTabris:\r\n```javascript\r\nconst xhr = new XMLHttpRequest()\r\n\r\nxhr.onload = function() { /* Not called */ }\r\nxhr.onerror = function() { /* Not called */ }\r\nxhr.onabort = function() { /* Not called */ }\r\nxhr.ontimeout = function() { /* Not called */ }\r\n\r\nxhr.onreadystatechange = function() {\r\n    switch (xhr.readyState) {\r\n        case 1: console.log('opened, not sent'); break // Called\r\n        case 2: console.log('sent, awaiting response'); break // Not called, even though the API gets the request\r\n        case 3: console.log('response received, downloading'); break // Not called\r\n        case 4: console.log('finished'); break // Not called\r\n    }\r\n}\r\n\r\nxhr.open('GET', 'http://ip.ad.dr.ess:port/', true)\r\nxhr.send()\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/comments/309008187","html_url":"https://github.com/eclipsesource/tabris-js/issues/1382#issuecomment-309008187","issue_url":"https://api.github.com/repos/eclipsesource/tabris-js/issues/1382","id":309008187,"user":{"login":"CooperITP","id":28659049,"avatar_url":"https://avatars1.githubusercontent.com/u/28659049?v=3","gravatar_id":"","url":"https://api.github.com/users/CooperITP","html_url":"https://github.com/CooperITP","followers_url":"https://api.github.com/users/CooperITP/followers","following_url":"https://api.github.com/users/CooperITP/following{/other_user}","gists_url":"https://api.github.com/users/CooperITP/gists{/gist_id}","starred_url":"https://api.github.com/users/CooperITP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CooperITP/subscriptions","organizations_url":"https://api.github.com/users/CooperITP/orgs","repos_url":"https://api.github.com/users/CooperITP/repos","events_url":"https://api.github.com/users/CooperITP/events{/privacy}","received_events_url":"https://api.github.com/users/CooperITP/received_events","type":"User","site_admin":false},"created_at":"2017-06-16T11:56:58Z","updated_at":"2017-06-16T11:56:58Z","body":"Well I am not sure at all what happened, but today I came in and started both up and it is working just fine. The only thing I did do was tried to update tabris, though no real update happened. I was on the current version as it was. Maybe I modified those files by accident in a really inconvenient way? Not sure."}}
{"actor":{"display_login":"CooperITP"}}