Skip to content

Commit 9eb12aa

Browse files
author
Sankarsan Kampa
committed
Used got instead of request lib to fix prototype pollution: https://snyk.io/vuln/npm:hoek:20180212
1 parent 24719ed commit 9eb12aa

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pokedex-api",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "A wrapper library for the Pokédex API. Get all your Pokémon Needs in one place.",
55
"main": "index.js",
66
"scripts": {
@@ -32,7 +32,6 @@
3232
"eslint": "^4.17.0"
3333
},
3434
"dependencies": {
35-
"request": "^2.83.0",
36-
"request-promise-native": "^1.0.5"
35+
"got": "^8.1.0"
3736
}
3837
}

src/Pokedex.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
const config = require('../settings/config.json');
8-
const request = require('request-promise-native');
8+
const request = require('got');
99

1010
/**
1111
* @class Pokedex
@@ -46,16 +46,15 @@ class Pokedex {
4646
this.makeRequest = async function(path) {
4747
try {
4848
let options = {
49-
uri: `${this.BASE_URL}${path}`,
5049
headers: {
5150
'User-Agent': this.USER_AGENT,
5251
'Auth': this.AUTH
5352
},
5453
json: true
5554
};
5655

57-
let response = await request(options);
58-
return response;
56+
let response = await request(`${this.BASE_URL}${path}`, options);
57+
return response.body;
5958
}
6059
catch (e) {
6160
throw e;

0 commit comments

Comments
 (0)