Skip to content

Commit 2c6767b

Browse files
committed
Migrate to bent from the deprecated request library
1 parent 8dae069 commit 2c6767b

File tree

3 files changed

+401
-701
lines changed

3 files changed

+401
-701
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,14 @@
429429
}
430430
},
431431
"devDependencies": {
432+
"@types/bent": "^7.3.2",
432433
"@types/cheerio": "^0.22.30",
433434
"@types/glob": "^7.1.4",
434435
"@types/js-yaml": "^4.0.5",
435436
"@types/lodash-es": "^4.17.3",
436437
"@types/lru-cache": "^7.6.1",
437438
"@types/mocha": "^9.0.0",
438439
"@types/node": "^17.0.23",
439-
"@types/request-promise-native": "^1.0.17",
440440
"@types/vscode": "^1.52.0",
441441
"@types/which": "^2.0.1",
442442
"@types/yauzl": "^2.9.1",
@@ -461,13 +461,12 @@
461461
"justusadam.language-haskell"
462462
],
463463
"dependencies": {
464+
"bent": "^7.3.12",
464465
"cheerio": "^1.0.0-rc.10",
465466
"extend": ">=3.0.2",
466467
"js-yaml": "^4.1.0",
467468
"lodash-es": "^4.17.21",
468469
"lru-cache": "^7.7.3",
469-
"request": "^2.88.2",
470-
"request-promise-native": "^1.0.8",
471470
"ts-pattern": "^4.0.1",
472471
"vscode-languageclient": "^7.0.0",
473472
"which": "^2.0.1",

src/commands/importIdentifier.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import * as cheerio from 'cheerio';
22
import * as yaml from 'js-yaml';
33
import escapeRegExp from 'lodash-es/escapeRegExp';
44
import * as LRUCache from 'lru-cache';
5-
import * as request from 'request-promise-native';
5+
import * as bent from 'bent';
66
import * as vscode from 'vscode';
77
import { CommandNames } from './constants';
88

9+
const getJson = bent('json');
10+
911
const askHoogle = async (variable: string): Promise<any> => {
10-
return await request({
11-
url: `https://hoogle.haskell.org/?hoogle=${variable}&scope=set%3Astackage&mode=json`,
12-
json: true,
13-
}).promise();
12+
return await getJson(
13+
`https://hoogle.haskell.org/?hoogle=${variable}&scope=set%3Astackage&mode=json`
14+
);
1415
};
1516

1617
const withCache =

0 commit comments

Comments
 (0)