Fossil SCM
JS fossil.fetch(): moved an XHR.setRequestHeader() call to after the XHR.open() call because FF now says it must be done in that order.
Commit
98f3c05c09ac07cf4ca54a062dd8f64addb132cf3fe52e51507ba70a3757e061
Parent
23e138e808ff340…
1 file changed
+3
-3
+3
-3
| --- src/fossil.fetch.js | ||
| +++ src/fossil.fetch.js | ||
| @@ -144,13 +144,10 @@ | ||
| 144 | 144 | opt.contentType = 'application/json'; |
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | const url=[F.repoUrl(uri,opt.urlParams)], |
| 148 | 148 | x=new XMLHttpRequest(); |
| 149 | - if('POST'===opt.method && 'string'===typeof opt.contentType){ | |
| 150 | - x.setRequestHeader('Content-Type',opt.contentType); | |
| 151 | - } | |
| 152 | 149 | if('json'===opt.responseType){ |
| 153 | 150 | /* 'json' is an extension to the supported XHR.responseType |
| 154 | 151 | list. We use it as a flag to tell us to JSON.parse() |
| 155 | 152 | the response. */ |
| 156 | 153 | jsonResponse = true; |
| @@ -195,14 +192,17 @@ | ||
| 195 | 192 | opt.onerror(e); |
| 196 | 193 | } |
| 197 | 194 | }; |
| 198 | 195 | try{opt.beforesend()}catch(e){/*ignore*/} |
| 199 | 196 | x.open(opt.method||'GET', url.join(''), true); |
| 197 | + if('POST'===opt.method && 'string'===typeof opt.contentType){ | |
| 198 | + x.setRequestHeader('Content-Type',opt.contentType); | |
| 199 | + } | |
| 200 | 200 | x.timeout = +opt.timeout || f.timeout; |
| 201 | 201 | if(undefined!==payload) x.send(payload); |
| 202 | 202 | else x.send(); |
| 203 | 203 | return this; |
| 204 | 204 | }; |
| 205 | 205 | |
| 206 | 206 | window.fossil.fetch.beforesend = function(){}; |
| 207 | 207 | window.fossil.fetch.aftersend = function(){}; |
| 208 | 208 | window.fossil.fetch.timeout = 15000/* Default timeout, in ms. */; |
| 209 | 209 |
| --- src/fossil.fetch.js | |
| +++ src/fossil.fetch.js | |
| @@ -144,13 +144,10 @@ | |
| 144 | opt.contentType = 'application/json'; |
| 145 | } |
| 146 | } |
| 147 | const url=[F.repoUrl(uri,opt.urlParams)], |
| 148 | x=new XMLHttpRequest(); |
| 149 | if('POST'===opt.method && 'string'===typeof opt.contentType){ |
| 150 | x.setRequestHeader('Content-Type',opt.contentType); |
| 151 | } |
| 152 | if('json'===opt.responseType){ |
| 153 | /* 'json' is an extension to the supported XHR.responseType |
| 154 | list. We use it as a flag to tell us to JSON.parse() |
| 155 | the response. */ |
| 156 | jsonResponse = true; |
| @@ -195,14 +192,17 @@ | |
| 195 | opt.onerror(e); |
| 196 | } |
| 197 | }; |
| 198 | try{opt.beforesend()}catch(e){/*ignore*/} |
| 199 | x.open(opt.method||'GET', url.join(''), true); |
| 200 | x.timeout = +opt.timeout || f.timeout; |
| 201 | if(undefined!==payload) x.send(payload); |
| 202 | else x.send(); |
| 203 | return this; |
| 204 | }; |
| 205 | |
| 206 | window.fossil.fetch.beforesend = function(){}; |
| 207 | window.fossil.fetch.aftersend = function(){}; |
| 208 | window.fossil.fetch.timeout = 15000/* Default timeout, in ms. */; |
| 209 |
| --- src/fossil.fetch.js | |
| +++ src/fossil.fetch.js | |
| @@ -144,13 +144,10 @@ | |
| 144 | opt.contentType = 'application/json'; |
| 145 | } |
| 146 | } |
| 147 | const url=[F.repoUrl(uri,opt.urlParams)], |
| 148 | x=new XMLHttpRequest(); |
| 149 | if('json'===opt.responseType){ |
| 150 | /* 'json' is an extension to the supported XHR.responseType |
| 151 | list. We use it as a flag to tell us to JSON.parse() |
| 152 | the response. */ |
| 153 | jsonResponse = true; |
| @@ -195,14 +192,17 @@ | |
| 192 | opt.onerror(e); |
| 193 | } |
| 194 | }; |
| 195 | try{opt.beforesend()}catch(e){/*ignore*/} |
| 196 | x.open(opt.method||'GET', url.join(''), true); |
| 197 | if('POST'===opt.method && 'string'===typeof opt.contentType){ |
| 198 | x.setRequestHeader('Content-Type',opt.contentType); |
| 199 | } |
| 200 | x.timeout = +opt.timeout || f.timeout; |
| 201 | if(undefined!==payload) x.send(payload); |
| 202 | else x.send(); |
| 203 | return this; |
| 204 | }; |
| 205 | |
| 206 | window.fossil.fetch.beforesend = function(){}; |
| 207 | window.fossil.fetch.aftersend = function(){}; |
| 208 | window.fossil.fetch.timeout = 15000/* Default timeout, in ms. */; |
| 209 |