Skip to content

Commit

Permalink
fixes #19000, strip fragment from URL before sending request for IE<=…
Browse files Browse the repository at this point in the history
…10, which breaks xhr spec.
  • Loading branch information
adros authored and dylans committed Apr 13, 2017
1 parent d615824 commit 762bbd7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions request/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ define([
url = response.url;
options = response.options;

if(has('ie') <= 10){
// older IE breaks point 9 in http://www.w3.org/TR/XMLHttpRequest/#the-open()-method and sends fragment, so strip it
url = url.split('#')[0];
}

var remover,
last = function(){
remover && remover();
Expand Down
1 change: 1 addition & 0 deletions tests/services/request/xhr.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ define([
method: request.method,
query: request.query,
headers: request.headers,
url : request.nodeRequest.url,
payload: data || null
})
]
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/request/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,18 @@ define([
);
},

'strip fragment': function () {
var def = this.async(),
promise = xhr.get('/__services/request/xhr?color=blue#some-hash', {
handleAs: 'json'
});

promise.response.then(def.callback(function (response) {
assert.strictEqual(response.data.method, 'GET');
assert.strictEqual(response.data.url, '/__services/request/xhr?color=blue');
}));
},

'form data': {
setup: function () {
if(!hasFormData) { return; }
Expand Down

0 comments on commit 762bbd7

Please sign in to comment.