vue-file-agent
vue-file-agent copied to clipboard
How to add HTTP header to URL when retrieve file.
I would like to add HTTP header to URL. I noticed that upload function inside vue-file-agent enable user to send along with HTTP header. How to add HTTP header to URL when we want to retrieve file instead of uploading the file?
Sample code for uploading the file copied from https://safrazik.com/vue-file-agent/.
fileRecords: [],
uploadUrl: 'https://www.mocky.io/v2/5d4fb20b3000005c111099e3',
uploadHeaders: { 'X-Test-Header': 'vue-file-agent' },
fileRecordsForUpload: [], // maintain an upload queue
};
Below is the current snippet code for retrieving the file. I tried to include header
variable into the file array, but it does not working.
...
fileArray.push({
name:
size:
type:
header: { 'Authorization': 'Bearer XXXXX' }
url:
});
});
this.fileRecords = fileArray;
Thank you.
@haizad did you manage to find a solution for this scenario? Same issue here... Thank you.