mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-04-24 00:00:03 +08:00
594d03aa41
- feat(www): implement preprocessor for FormData instances - feat(www): implement API checks for multipart requests - feat(android): implement multipart requests - chore(specs): implement www specs for new prprocessor
36 lines
704 B
JavaScript
36 lines
704 B
JavaScript
module.exports = class BlobMock {
|
|
constructor(blobParts, options) {
|
|
if (blobParts instanceof BlobMock) {
|
|
this._buffer = blobParts._buffer;
|
|
} else {
|
|
this._buffer = new Uint8Array(Buffer.concat(blobParts.map(part => Buffer.from(part, 'utf8')))).buffer;
|
|
}
|
|
|
|
this._type = options.type || '';
|
|
}
|
|
|
|
get size() {
|
|
return this._buffer.length;
|
|
}
|
|
|
|
get type() {
|
|
return this._type;
|
|
}
|
|
|
|
arrayBuffer() {
|
|
throw new Error('Not implemented in BlobMock.');
|
|
}
|
|
|
|
slice() {
|
|
throw new Error('Not implemented in BlobMock.');
|
|
}
|
|
|
|
stream() {
|
|
throw new Error('Not implemented in BlobMock.');
|
|
}
|
|
|
|
text() {
|
|
throw new Error('Not implemented in BlobMock.');
|
|
}
|
|
}
|