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
53 lines
860 B
JavaScript
53 lines
860 B
JavaScript
const BlobMock = require('./Blob.mock');
|
|
const FileMock = require('./File.mock');
|
|
|
|
module.exports = class FormDataMock {
|
|
constructor() {
|
|
this.map = new Map();
|
|
}
|
|
|
|
append(name, value, filename) {
|
|
if (value instanceof BlobMock) {
|
|
this.map.set(name, new FileMock(value, filename))
|
|
} else {
|
|
this.map.set(name, value);
|
|
}
|
|
}
|
|
|
|
delete() {
|
|
throw new Error('Not implemented in FormDataMock.');
|
|
}
|
|
|
|
entries() {
|
|
return this.map.entries();
|
|
}
|
|
|
|
forEach(cb) {
|
|
return this.map.forEach(cb);
|
|
}
|
|
|
|
get(key) {
|
|
return this.map.get(key);
|
|
}
|
|
|
|
getAll() {
|
|
throw new Error('Not implemented in FormDataMock.');
|
|
}
|
|
|
|
has(key) {
|
|
return this.map.has(key);
|
|
}
|
|
|
|
keys() {
|
|
return this.map.keys();
|
|
}
|
|
|
|
set(key, value) {
|
|
return this.map.set(key, value);
|
|
}
|
|
|
|
values() {
|
|
return this.map.values();
|
|
}
|
|
};
|