Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 5333a30

Browse files
refactor: attempt to remove request (#700)
1 parent 99c3821 commit 5333a30

File tree

4 files changed

+12
-39
lines changed

4 files changed

+12
-39
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@
4242
"gts": "^1.0.0",
4343
"intelli-espower-loader": "^1.0.1",
4444
"js-green-licenses": "^0.5.0",
45+
"linkinator": "^1.1.2",
4546
"mkdirp": "^0.5.1",
4647
"mocha": "^6.0.0",
4748
"ncp": "^2.0.0",
4849
"nock": "^10.0.0",
4950
"nyc": "^14.0.0",
5051
"post-install-check": "0.0.1",
5152
"proxyquire": "^2.0.0",
52-
"request": "^2.88.0",
5353
"require-inject": "^1.4.3",
5454
"source-map-support": "^0.5.6",
55+
"teeny-request": "^3.11.3",
5556
"typescript": "~3.4.0",
56-
"uuid": "^3.3.2",
57-
"linkinator": "^1.1.2"
57+
"uuid": "^3.3.2"
5858
},
5959
"dependencies": {
6060
"@google-cloud/common": "^1.0.0",

src/client/stackdriver/debug.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
import {GoogleAuthOptions, Service} from '@google-cloud/common';
18-
import * as request from 'request'; // Only for type declarations.
1918

2019
export interface PackageInfo {
2120
name: string;

test/auth-request.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

test/test-controller.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,22 @@ import * as nock from 'nock';
2020
import {Debug} from '../src/client/stackdriver/debug';
2121
import {Debuggee} from '../src/debuggee';
2222
import * as stackdriver from '../src/types/stackdriver';
23-
24-
import {authRequest as request} from './auth-request';
23+
import * as r from 'request'; // types only
24+
import {teenyRequest} from 'teeny-request';
2525

2626
// the tests in this file rely on the GCLOUD_PROJECT environment variable
2727
// not being set
2828
delete process.env.GCLOUD_PROJECT;
2929

3030
import {Controller} from '../src/agent/controller';
3131
// TODO: Fix fakeDebug to actually implement Debug.
32-
const fakeDebug: Debug = ({request} as {}) as Debug;
32+
const fakeDebug = ({
33+
request: (options: r.Options, cb: r.RequestCallback) => {
34+
teenyRequest(options, (err, r) => {
35+
cb(err, r ? r.body : undefined, r);
36+
});
37+
},
38+
} as {}) as Debug;
3339

3440
const agentVersion = `SomeName/client/SomeVersion`;
3541
const url = 'https://clouddebugger.googleapis.com';

0 commit comments

Comments
 (0)