{"action":"created","issue":{"url":"https://api.github.com/repos/pyrsmk/qwest/issues/50","labels_url":"https://api.github.com/repos/pyrsmk/qwest/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/pyrsmk/qwest/issues/50/comments","events_url":"https://api.github.com/repos/pyrsmk/qwest/issues/50/events","html_url":"https://github.com/pyrsmk/qwest/issues/50","id":70085398,"number":50,"title":"Throws error if content-type is missing in header","user":{"login":"mdix","id":1155015,"avatar_url":"https://avatars.githubusercontent.com/u/1155015?v=3","gravatar_id":"","url":"https://api.github.com/users/mdix","html_url":"https://github.com/mdix","followers_url":"https://api.github.com/users/mdix/followers","following_url":"https://api.github.com/users/mdix/following{/other_user}","gists_url":"https://api.github.com/users/mdix/gists{/gist_id}","starred_url":"https://api.github.com/users/mdix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdix/subscriptions","organizations_url":"https://api.github.com/users/mdix/orgs","repos_url":"https://api.github.com/users/mdix/repos","events_url":"https://api.github.com/users/mdix/events{/privacy}","received_events_url":"https://api.github.com/users/mdix/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pyrsmk/qwest/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-22T10:19:47Z","updated_at":"2015-04-23T07:46:08Z","closed_at":"2015-04-23T07:46:08Z","body":"If there's no Content-Type set in the header, qwest breaks with the following error:\r\n\r\n`\"Cannot read property 'indexOf' of null\"`\r\n\r\nThe error is caused because the else branch of the following code assumes that there's 'Content Type' in the header:\r\n\r\n```\r\nif(responseType=='auto'){\r\n    if(xdr){\r\n        responseType=defaultXdrResponseType;\r\n    }\r\n    else{\r\n        var ct=xhr.getResponseHeader(contentType);\r\n        if(ct.indexOf(mimeTypes.json)>-1){\r\n            responseType='json';\r\n        }\r\n        else if(ct.indexOf(mimeTypes.xml)>-1){\r\n            responseType='xml';\r\n        }\r\n        else{\r\n            responseType='text';\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThere should be an additional check that falls back to text if nothing is set:\r\n\r\n```\r\nif (ct.length < 1) {\r\n    responseType='text';\r\n}\r\n```\r\n\r\nBest\r\nMarc"},"comment":{"url":"https://api.github.com/repos/pyrsmk/qwest/issues/comments/95479148","html_url":"https://github.com/pyrsmk/qwest/issues/50#issuecomment-95479148","issue_url":"https://api.github.com/repos/pyrsmk/qwest/issues/50","id":95479148,"user":{"login":"pyrsmk","id":214497,"avatar_url":"https://avatars.githubusercontent.com/u/214497?v=3","gravatar_id":"","url":"https://api.github.com/users/pyrsmk","html_url":"https://github.com/pyrsmk","followers_url":"https://api.github.com/users/pyrsmk/followers","following_url":"https://api.github.com/users/pyrsmk/following{/other_user}","gists_url":"https://api.github.com/users/pyrsmk/gists{/gist_id}","starred_url":"https://api.github.com/users/pyrsmk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyrsmk/subscriptions","organizations_url":"https://api.github.com/users/pyrsmk/orgs","repos_url":"https://api.github.com/users/pyrsmk/repos","events_url":"https://api.github.com/users/pyrsmk/events{/privacy}","received_events_url":"https://api.github.com/users/pyrsmk/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T07:46:08Z","updated_at":"2015-04-23T07:46:08Z","body":"Thanks for reporting it ;) Should be fixed with latest commit"}}