Skip to content

Commit

Permalink
Properly split response headers and send as Object
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Deslandes <[email protected]>
  • Loading branch information
guillaumedeslandes committed Sep 21, 2020
1 parent 20a956f commit 15e1588
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion addon/uploaders/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,18 @@ export default EmberObject.extend(Evented, {
didUpload (data, status, xhr) {
set(this, 'isUploading', false);
this.trigger('didUpload', data);

const headers = {};
xhr
.getAllResponseHeaders().trim().split(/[\r\n]+/)
.map((header) => {
const [key, value] = header.split(': ');
headers[key] = value;
}),
this.trigger('didUpload.withHeaders',
{
data,
headers: xhr.getAllResponseHeaders(),
headers,
status,
xhr
});
Expand Down

0 comments on commit 15e1588

Please sign in to comment.