mirror of
https://github.com/silkimen/cordova-plugin-advanced-http.git
synced 2026-04-24 00:00:03 +08:00
WIP: major progress for #101
- 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
This commit is contained in:
+24
-13
@@ -1,6 +1,17 @@
|
||||
const BlobMock = require('./Blob.mock');
|
||||
const FileMock = require('./File.mock');
|
||||
|
||||
module.exports = class FormDataMock {
|
||||
append() {
|
||||
throw new Error('Not implemented in 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() {
|
||||
@@ -8,34 +19,34 @@ module.exports = class FormDataMock {
|
||||
}
|
||||
|
||||
entries() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
return this.map.entries();
|
||||
}
|
||||
|
||||
forEach() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
forEach(cb) {
|
||||
return this.map.forEach(cb);
|
||||
}
|
||||
|
||||
get() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
get(key) {
|
||||
return this.map.get(key);
|
||||
}
|
||||
|
||||
getAll() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
}
|
||||
|
||||
has() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
has(key) {
|
||||
return this.map.has(key);
|
||||
}
|
||||
|
||||
keys() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
return this.map.keys();
|
||||
}
|
||||
|
||||
set() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
set(key, value) {
|
||||
return this.map.set(key, value);
|
||||
}
|
||||
|
||||
values() {
|
||||
throw new Error('Not implemented in FormDataMock.');
|
||||
return this.map.values();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user