Skip to content

Commit 688e936

Browse files
authored
Check if job header is present (#623)
1 parent bb8955f commit 688e936

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/RESTController.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ const RESTController = {
103103
response = JSON.parse(xhr.responseText);
104104

105105
if (typeof xhr.getResponseHeader === 'function') {
106-
var jobStatusId = xhr.getResponseHeader('x-parse-job-status-id');
107-
if (jobStatusId) {
108-
response = jobStatusId;
106+
if ((xhr.getAllResponseHeaders() || '').includes('x-parse-job-status-id: ')) {
107+
response = xhr.getResponseHeader('x-parse-job-status-id');
109108
}
110109
}
111110
} catch (e) {

src/__tests__/RESTController-test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ describe('RESTController', () => {
221221
this.responseText = '{}';
222222
this.readyState = 4;
223223
this.onreadystatechange();
224+
},
225+
getAllResponseHeaders: function() {
226+
return 'x-parse-job-status-id: 1234';
224227
}
225228
};
226229
RESTController._setXHR(XHR);
@@ -239,6 +242,9 @@ describe('RESTController', () => {
239242
this.responseText = '{"result":"hello"}';
240243
this.readyState = 4;
241244
this.onreadystatechange();
245+
},
246+
getAllResponseHeaders: function() {
247+
return null;
242248
}
243249
};
244250
RESTController._setXHR(XHR);

0 commit comments

Comments
 (0)