fix(UrlParser): stop setting default value 'true' (#10399)
This commit is contained in:
parent
c8989c900f
commit
0d6cc17252
|
@ -406,7 +406,7 @@ class UrlParser {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.capture(key);
|
this.capture(key);
|
||||||
let value: any = 'true';
|
let value: any = '';
|
||||||
if (this.peekStartsWith('=')) {
|
if (this.peekStartsWith('=')) {
|
||||||
this.capture('=');
|
this.capture('=');
|
||||||
var valueMatch = matchUrlQueryParamValue(this.remaining);
|
var valueMatch = matchUrlQueryParamValue(this.remaining);
|
||||||
|
|
|
@ -142,12 +142,22 @@ describe('url serializer', () => {
|
||||||
|
|
||||||
it('should parse key only query params', () => {
|
it('should parse key only query params', () => {
|
||||||
const tree = url.parse('/one?a');
|
const tree = url.parse('/one?a');
|
||||||
expect(tree.queryParams).toEqual({a: 'true'});
|
expect(tree.queryParams).toEqual({a: ''});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse a value-empty query param', () => {
|
||||||
|
const tree = url.parse('/one?a=');
|
||||||
|
expect(tree.queryParams).toEqual({a: ''});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse value-empty query params', () => {
|
||||||
|
const tree = url.parse('/one?a=&b=');
|
||||||
|
expect(tree.queryParams).toEqual({a: '', b: ''});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should serializer query params', () => {
|
it('should serializer query params', () => {
|
||||||
const tree = url.parse('/one?a');
|
const tree = url.parse('/one?a');
|
||||||
expect(url.serialize(tree)).toEqual('/one?a=true');
|
expect(url.serialize(tree)).toEqual('/one?a=');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse fragment', () => {
|
it('should parse fragment', () => {
|
||||||
|
|
Loading…
Reference in New Issue