Skip to content

Commit 6578727

Browse files
committed
chore: removed unneeded modules
1 parent a26165a commit 6578727

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@
9595
"request": "^2.88.2",
9696
"sinon": "^17.0.1",
9797
"slow-stream": "0.0.4",
98-
"socks": "^2.7.1",
99-
"socks-proxy-agent": "^8.0.2",
10098
"tempy": "^3.1.0",
10199
"then-busboy": "^5.2.1",
102100
"tough-cookie": "^4.1.3",

test/error.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import net from 'node:net';
44
import http from 'node:http';
55
import stream from 'node:stream';
66
import {pipeline as streamPipeline} from 'node:stream/promises';
7+
import {Agent} from 'node:https';
78
import test from 'ava';
89
import getStream from 'get-stream';
910
import is from '@sindresorhus/is';
10-
import {SocksProxyAgent} from 'socks-proxy-agent';
11-
import {SocksClientError} from 'socks';
1211
import got, {RequestError, HTTPError, TimeoutError} from '../source/index.js';
1312
import type Request from '../source/core/index.js';
1413
import withServer from './helpers/with-server.js';
@@ -369,10 +368,17 @@ test('should wrap got cause', async t => {
369368
});
370369

371370
test('should wrap non-got cause', async t => {
371+
class SocksProxyAgent extends Agent {
372+
createConnection() {
373+
throw new SocksClientError('oh no');
374+
}
375+
}
376+
class SocksClientError extends Error {}
372377
const error = await t.throwsAsync<RequestError>(got('https://github.com', {retry: {limit: 0}, timeout: {read: 1}, agent: {https: new SocksProxyAgent('socks://your-name%40gmail.com:[email protected]')}}));
373378
const cause = error?.cause as Error;
374379
t.is(error?.code, 'ERR_GOT_REQUEST_ERROR');
375380
t.is(error?.message, cause.message);
381+
t.is(error?.message, 'oh no');
376382
t.assert(cause instanceof SocksClientError);
377383
});
378384

0 commit comments

Comments
 (0)