fix(http): check response body text against undefined (#13017)
This commit is contained in:
parent
a006c1418a
commit
08ff2e5249
|
@ -47,7 +47,7 @@ export abstract class Body {
|
|||
return String.fromCharCode.apply(null, new Uint16Array(<ArrayBuffer>this._body));
|
||||
}
|
||||
|
||||
if (this._body === null) {
|
||||
if (this._body == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -88,5 +88,14 @@ export function main() {
|
|||
|
||||
expect(req.text()).toEqual('');
|
||||
});
|
||||
|
||||
it('should return empty string if body is undefined', () => {
|
||||
const reqOptions = new RequestOptions(
|
||||
{url: 'test', method: 'GET', headers: new Headers({'content-type': 'application/json'})});
|
||||
delete reqOptions.body;
|
||||
const req = new Request(reqOptions);
|
||||
|
||||
expect(req.text()).toEqual('');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue