fix(http): don't create a blob out of ArrayBuffer when type is application/octet-stream (#13992)

Closes #13973
This commit is contained in:
Dzmitry Shylovich
2017-01-19 03:01:02 +03:00
committed by Miško Hevery
parent 2af58622c1
commit 015878afe6
2 changed files with 15 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import {describe, expect, it} from '@angular/core/testing/testing_internal';
import {RequestOptions} from '../src/base_request_options';
import {ContentType} from '../src/enums';
import {Headers} from '../src/headers';
import {Request} from '../src/static_request';
import {ArrayBuffer, Request} from '../src/static_request';
export function main() {
describe('Request', () => {
@ -76,6 +76,17 @@ export function main() {
expect(req.detectContentType()).toEqual(ContentType.BLOB);
});
it('should not create a blob out of ArrayBuffer', () => {
const req = new Request(new RequestOptions({
url: 'test',
method: 'GET',
body: new ArrayBuffer(1),
headers: new Headers({'content-type': 'application/octet-stream'})
}));
expect(req.detectContentType()).toEqual(ContentType.ARRAY_BUFFER);
});
});
it('should return empty string if no body is present', () => {