зеркало из https://github.com/github/fetch.git
Test demonstrating blob does not handle non-ascii data correctly.
This commit is contained in:
Родитель
84395a37fb
Коммит
49907c8640
|
@ -28,6 +28,10 @@ var routes = {
|
|||
});
|
||||
res.end('hi');
|
||||
},
|
||||
'/nonascii': function(res) {
|
||||
res.writeHead(200, {'Content-Type': 'text/plain'});
|
||||
res.end(new Buffer([200, 201]));
|
||||
},
|
||||
'/redirect/301': function(res) {
|
||||
res.writeHead(301, {'Location': '/hello'});
|
||||
res.end();
|
||||
|
|
|
@ -73,6 +73,15 @@ suite('Body mixin', function() {
|
|||
})
|
||||
})
|
||||
|
||||
test('blob handles non-ascii data', function() {
|
||||
return fetch('/nonascii').then(function(response) {
|
||||
return response.blob()
|
||||
}).then(function(blob) {
|
||||
assert(blob instanceof Blob, 'blob is a Blob instance')
|
||||
assert.equal(blob.size, 2, 'blob.size is correct')
|
||||
})
|
||||
})
|
||||
|
||||
test('rejects blob promise after body is consumed', function() {
|
||||
return fetch('/hello').then(function(response) {
|
||||
assert(response.blob, 'Body does not implement blob')
|
||||
|
|
Загрузка…
Ссылка в новой задаче