From 8c2b3fcafb3e264cba259cd126df4694cef5c4de Mon Sep 17 00:00:00 2001 From: Bruno Vieira Date: Thu, 21 Aug 2014 23:08:28 +0100 Subject: [PATCH] Fix xhr.responseType set before xhr.open --- lib/request.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/request.js b/lib/request.js index 234a2f4..6a3c1ed 100644 --- a/lib/request.js +++ b/lib/request.js @@ -21,16 +21,16 @@ var Request = module.exports = function (xhr, params) { try { xhr.withCredentials = params.withCredentials } catch (e) {} - - if (params.responseType) try { xhr.responseType = params.responseType } - catch (e) {} - + xhr.open( params.method || 'GET', self.uri, true ); + if (params.responseType) try { xhr.responseType = params.responseType } + catch (e) {} + xhr.onerror = function(event) { self.emit('error', new Error('Network error')); };