Skip to content

Commit

Permalink
Addressing lint errors
Browse files Browse the repository at this point in the history
Taking care of issues marked by linter.
  • Loading branch information
nikhilsane committed Apr 25, 2019
1 parent d5ce5a5 commit 5dbe689
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ test('ajaxOptions() adds Accept header to existing computed properties headers',
);
});

test('ajaxOptions() does not overwrite Accept header if it is provided', function(assert){
test('ajaxOptions() does not overwrite Accept header if it is provided', function(assert) {
let url = 'example.com';
let type = 'GET';
adapter.headers = { 'Accept': 'application/json' };
adapter.headers = { Accept: 'application/json' };
let ajaxOptions = adapter.ajaxOptions(url, type, {});
let receivedHeaders = [];
let fakeXHR = {
setRequestHeader(key, value) {
receivedHeaders.push([key,value]);
receivedHeaders.push([key, value]);
},
};
ajaxOptions.beforeSend(fakeXHR);
Expand All @@ -102,4 +102,4 @@ test('ajaxOptions() does not overwrite Accept header if it is provided', functio
[['Accept', 'application/json']],
'Accept header is not overwritten'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ test('ajaxOptions() adds Accept header to existing computed properties headers',
);
});

test('ajaxOptions() does not overwrite passed value of Accept headers', function(assert){
adapter.headers = { 'Other-Key': 'Other Value', 'Accept' : 'application/json'};
test('ajaxOptions() does not overwrite passed value of Accept headers', function(assert) {
adapter.headers = { 'Other-Key': 'Other Value', Accept : 'application/json'};
let url = 'example.com';
let type = 'GET';
let ajaxOptions = adapter.ajaxOptions(url, type, {});
Expand All @@ -84,9 +84,10 @@ test('ajaxOptions() does not overwrite passed value of Accept headers', function
assert.deepEqual(
receivedHeaders,
{
'Accept': 'application/json',
Accept: 'application/json',
'Other-Key': 'Other Value',
},
'headers assigned, Accept header not overwritten'
);
})
});

4 changes: 2 additions & 2 deletions packages/adapter/addon/json-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ const JSONAPIAdapter = RESTAdapter.extend({
*/
ajaxOptions(url, type, options = {}) {
options.contentType = options.contentType || 'application/vnd.api+json';

let hash = this._super(url, type, options);
hash.headers['Accept'] = hash.headers['Accept'] || 'application/vnd.api+json';

return hash;
},

Expand Down

0 comments on commit 5dbe689

Please sign in to comment.