Skip to content

Commit

Permalink
fix: connection types
Browse files Browse the repository at this point in the history
Signed-off-by: Timur Bolotov <[email protected]>
  • Loading branch information
timursaurus committed Jul 16, 2023
1 parent ae4b369 commit cd7ce93
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/transport/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,17 @@ export class Connection {
return request;
}


request(
params: ConnectionRequestParams,
callback: (err: Error | null, response: http.ServerResponse | null) => void
) {
callback: (err: Error | null, response: http.IncomingMessage | null) => void
): http.ClientRequest {
this._openRequests++;
let cleanedListeners = false;
const requestParams = this.buildRequestObject(params);
if (INVALID_PATH_REGEX.test(requestParams.path as string) === true) {
callback(new TypeError(`ERR_UNESCAPED_CHARACTERS: ${requestParams.path}`), null);
return { abort: NOOP };
return { abort: NOOP } as http.ClientRequest;
}

debug("Starting a new request", params);
Expand All @@ -205,8 +206,6 @@ export class Connection {
this._openRequests--;
request.once("error", NOOP);
request.abort();
// TODO: This should be a TimeoutError
// callback(new TimeoutError("Request timed out", params), null);
callback(new TimeoutError("Request timed out"), null);
};

Expand Down

0 comments on commit cd7ce93

Please sign in to comment.