Skip to content

Commit

Permalink
chore: Use fetch as default for browsers instead of reqwest
Browse files Browse the repository at this point in the history
  • Loading branch information
manueltanzi-okta committed Mar 27, 2019
1 parent 076d18c commit a458ce2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
4 changes: 2 additions & 2 deletions fetch/fetchRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function fetchRequest(method, url, args) {
}
return result;
};
if (response.headers.get('Accept') &&
response.headers.get('Accept').toLowerCase().indexOf('application/json') >= 0) {
if (response.headers.get('Content-Type') &&
response.headers.get('Content-Type').toLowerCase().indexOf('application/json') >= 0) {
return response.json().then(respHandler);
} else {
return response.text().then(respHandler);
Expand Down
17 changes: 0 additions & 17 deletions fetch/index.js

This file was deleted.

6 changes: 4 additions & 2 deletions lib/browser/browserIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
*
*/

// This exists to use reqwest for http requests by default when library used on browser
module.exports = require('../../reqwest');
var fetchRequest = require('../../fetch/fetchRequest');
var storageUtil = require('./browserStorage');

module.exports = require('./browser')(storageUtil, fetchRequest);
6 changes: 4 additions & 2 deletions lib/server/serverIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
*
*/

// This exists to use fetch for http requests by default when library used on server side
module.exports = require('../../fetch');
var fetchRequest = require('../../fetch/fetchRequest');
var storageUtil = require('./serverStorage');

module.exports = require('./server')(storageUtil, fetchRequest);

0 comments on commit a458ce2

Please sign in to comment.