-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial work on File and Array<File> support #4
base: master
Are you sure you want to change the base?
Conversation
Also see issue HriBB#3
Hmmm ... can we detect variable type from mutation? For example ...
or
But we still need to check for |
@@ -46,6 +67,10 @@ export class UploadNetworkInterface extends HTTPFetchNetworkInterface { | |||
let v = request.variables[key] | |||
if (v instanceof FileList) { | |||
Array.from(v).forEach(f => body.append(key, f)) | |||
} else if (isArrayOfFiles(v)) { | |||
for (var file in v) { | |||
return body.append(key, file); // this part seems buggy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return
here will cause only the first file to get appended
|
||
isUpload({ request }) { | ||
if (request.variables) { | ||
for (let key in request.variables) { | ||
if (request.variables[key] instanceof FileList) { | ||
return true | ||
} | ||
if (request.variables[key] instanceof File) { | ||
return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is off here
return true; | ||
} | ||
if (this.isArrayOfFiles(request.variables[key])) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rest of this file doesn't use semicolons, probably following Standard Style
Also see issue #3. My initial work on this. Got the checking to work, but adding the array to the request body fails. I've not tested appending only a File to the body.