Skip to content

Commit ffa4cdd

Browse files
authored
Merge pull request #21 from timursaurus/dev
Dev
2 parents ffb2bfe + 09ed659 commit ffa4cdd

File tree

3 files changed

+268
-102
lines changed

3 files changed

+268
-102
lines changed

.eslintrc.json

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454
"unicorn/no-await-expression-member": 0,
5555
"unicorn/no-useless-undefined": 0,
5656
"unicorn/no-array-push-push": 0,
57+
"unicorn/no-array-for-each": 0,
58+
"unicorn/prefer-includes": "warn",
5759
"unicorn/no-process-exit": 0,
5860
"unicorn/consistent-function-scoping": 0,
5961
"@typescript-eslint/no-explicit-any": 0,

src/transport/connection.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,17 @@ export class Connection {
178178
return request;
179179
}
180180

181+
181182
request(
182183
params: ConnectionRequestParams,
183-
callback: (err: Error | null, response: http.ServerResponse | null) => void
184-
) {
184+
callback: (err: Error | null, response: http.IncomingMessage | null) => void
185+
): http.ClientRequest {
185186
this._openRequests++;
186187
let cleanedListeners = false;
187188
const requestParams = this.buildRequestObject(params);
188189
if (INVALID_PATH_REGEX.test(requestParams.path as string) === true) {
189190
callback(new TypeError(`ERR_UNESCAPED_CHARACTERS: ${requestParams.path}`), null);
190-
return { abort: NOOP };
191+
return { abort: NOOP } as http.ClientRequest;
191192
}
192193

193194
debug("Starting a new request", params);
@@ -205,8 +206,6 @@ export class Connection {
205206
this._openRequests--;
206207
request.once("error", NOOP);
207208
request.abort();
208-
// TODO: This should be a TimeoutError
209-
// callback(new TimeoutError("Request timed out", params), null);
210209
callback(new TimeoutError("Request timed out"), null);
211210
};
212211

0 commit comments

Comments
 (0)