Skip to content

Commit

Permalink
switch from ember-network to ember-fetch
Browse files Browse the repository at this point in the history
ember-fetch is being more actively maintained and is more up-to-date with the fetch spec.

See discussion in tomdale/ember-network#17 and ember-cli/ember-fetch#21

The one change I made in the tests is because `headers.getAll` was [removed from the current WHATWG standard](https://www.fxsitecompat.com/en-CA/docs/2016/headers-getall-has-been-removed-in-favour-of-get-now-returning-all-values/), so ember-fetch doesn't implement it.

Also be advised that 1.4.0 <= ember-fetch < 1.4.2 actually conflicts with ember-network due to ember-cli/ember-fetch#27, which is how I even noticed my app was including ember-network via ember-simple-network.
  • Loading branch information
ef4 committed Apr 13, 2017
1 parent 52a2fca commit 6a146a2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions addon/authenticators/devise.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';
import BaseAuthenticator from './base';
import fetch from 'ember-network/fetch';
import fetch from 'fetch';

const { RSVP: { Promise }, isEmpty, run, assign: emberAssign, merge, computed } = Ember;
const assign = emberAssign || merge;
Expand Down Expand Up @@ -177,7 +177,7 @@ export default BaseAuthenticator.extend({

/**
Makes a request to the Devise server using
[ember-network/fetch](https://github.com/tomdale/ember-network#fetch).
[ember-fetch](https://github.com/stefanpenner/ember-fetch).
@method makeRequest
@param {Object} data The request data
Expand Down
2 changes: 1 addition & 1 deletion addon/authenticators/oauth2-password-grant.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Ember from 'ember';
import BaseAuthenticator from './base';
import fetch from 'ember-network/fetch';
import fetch from 'fetch';

const {
RSVP,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"ember-cli-babel": "^5.1.7",
"ember-cli-is-package-missing": "^1.0.0",
"ember-cookies": "^0.0.13",
"ember-fetch": "^1.4.2",
"ember-getowner-polyfill": "^1.1.0",
"ember-network": "^0.3.0",
"silent-error": "^1.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/authenticators/oauth2-password-grant-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ describe('OAuth2PasswordGrantAuthenticator', () => {

it('provides access to custom headers', function() {
return authenticator.authenticate('username', 'password').catch((error) => {
expect(error.headers.getAll('x-custom-context')[0]).to.eql('foobar');
expect(error.headers.get('x-custom-context')).to.eql('foobar');
});
});
});
Expand Down

0 comments on commit 6a146a2

Please sign in to comment.