Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

allow + in "grep" querystring; closes #2626

Christopher Hillerf6605cf012be
diff --git a/lib/utils.js b/lib/utils.js
index 657c7583..7395750d 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -322,7 +322,7 @@ exports.parseQuery = function (qs) {
var key = pair.slice(0, i);
var val = pair.slice(++i);
- obj[key] = decodeURIComponent(val);
+ obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
return obj;
}, {});
};
diff --git a/test/utils.spec.js b/test/utils.spec.js
index ccfd861a..4c5a9ca5 100644
--- a/test/utils.spec.js
+++ b/test/utils.spec.js
@@ -95,6 +95,10 @@ describe('utils', function () {
r3: '^co.*'
});
});
+
+ it('should parse "+" as a space', function () {
+ parseQuery('?grep=foo+bar').should.eql({grep: 'foo bar'});
+ });
});
describe('.stackTraceFilter()', function () {