fix(core): update

This commit is contained in:
Philipp Kunz 2020-01-12 19:36:58 +00:00
parent 23a2f597fc
commit eae4d09664

View File

@ -10,6 +10,7 @@ export interface IFormField {
type: 'string' | 'filePath' | 'Buffer'; type: 'string' | 'filePath' | 'Buffer';
payload: string | Buffer; payload: string | Buffer;
fileName?: string; fileName?: string;
contentType?: string;
} }
const appendFormField = async (formDataArg: plugins.formData, formDataField: IFormField) => { const appendFormField = async (formDataArg: plugins.formData, formDataField: IFormField) => {
@ -34,9 +35,9 @@ const appendFormField = async (formDataArg: plugins.formData, formDataField: IFo
}); });
break; break;
case 'Buffer': case 'Buffer':
formDataArg.append('file', formDataField.payload, { formDataArg.append(formDataField.name, formDataField.payload, {
filename: formDataField.fileName ? formDataField.fileName : 'upload.pdf', filename: formDataField.fileName ? formDataField.fileName : 'upload.pdf',
contentType: 'application/pdf' contentType: formDataField.contentType ? formDataField.contentType : 'application/pdf'
}); });
break; break;
} }