Skip to content

Commit

Permalink
chore: replace request and node-fetch with undici
Browse files Browse the repository at this point in the history
  • Loading branch information
p-kuen committed Feb 9, 2022
1 parent 4082187 commit 49bae1e
Show file tree
Hide file tree
Showing 5 changed files with 3,432 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ const results = await geocoder.batchGeocode([
]);

// Set specific http request headers:
const nodeFetch = require('node-fetch');
const undici = require('undici');
const fetch = undici.fetch;

const geocoder = NodeGeocoder({
provider: 'google',
Expand Down
3 changes: 2 additions & 1 deletion lib/httpadapter/fetchadapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

const HttpError = require('../error/httperror.js');
const nodeFetch = require('node-fetch');
const undici = require('undici');
const nodeFetch = undici.fetch;
const BPromise = require('bluebird');

class FetchAdapter {
Expand Down
3 changes: 2 additions & 1 deletion lib/httpadapter/requestadapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';

var HttpError = require('../error/httperror.js');
var request = require('request-promise');
var undici = require('undici');
var request = undici.request

/**
* RequestAdapter
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
},
"dependencies": {
"bluebird": "^3.5.2",
"node-fetch": "^2.6.0",
"request": "^2.88.0",
"request-promise": "^4.2.2"
"undici": "^4.13.0"
},
"devDependencies": {
"chai": "^3.5.0",
Expand Down
Loading

0 comments on commit 49bae1e

Please sign in to comment.