Skip to content

Commit

Permalink
Rename argument for the sessionProvider option for the Node HTTP client
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Stamm <ts@timostamm.de>
  • Loading branch information
timostamm committed Sep 4, 2024
1 parent e1e5613 commit e89359c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/connect-node/src/http2-session-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ export class Http2SessionManager {
private verifying: Promise<void> | undefined;

public constructor(
authority: URL | string,
url: URL | string,
pingOptions?: Http2SessionOptions,
http2SessionOptions?:
| http2.ClientSessionOptions
| http2.SecureClientSessionOptions,
) {
this.authority = new URL(authority).origin;
this.authority = new URL(url).origin;
this.http2SessionOptions = http2SessionOptions;
this.options = {
pingIntervalMs: pingOptions?.pingIntervalMs ?? Number.POSITIVE_INFINITY,
Expand Down
9 changes: 4 additions & 5 deletions packages/connect-node/src/node-universal-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ export type NodeHttpClientOptions =
httpVersion: "2";

/**
* A function that must return a session manager for the given authority.
* A function that must return a session manager for the given URL.
* The session manager may be taken from a pool.
* By default, a new Http2SessionManager is created for every request.
*/
sessionProvider?: (authority: string) => NodeHttp2ClientSessionManager;
sessionProvider?: (url: string) => NodeHttp2ClientSessionManager;
};

/**
Expand All @@ -80,8 +80,7 @@ export function createNodeHttpClient(options: NodeHttpClientOptions) {
return createNodeHttp1Client(options.nodeOptions);
}
const sessionProvider =
options.sessionProvider ??
((authority: string) => new Http2SessionManager(authority));
options.sessionProvider ?? ((url: string) => new Http2SessionManager(url));
return createNodeHttp2Client(sessionProvider);
}

Expand Down Expand Up @@ -169,7 +168,7 @@ function createNodeHttp1Client(
* an UniversalClientResponse.
*/
function createNodeHttp2Client(
sessionProvider: (authority: string) => NodeHttp2ClientSessionManager,
sessionProvider: (url: string) => NodeHttp2ClientSessionManager,
): UniversalClientFn {
return function request(
req: UniversalClientRequest,
Expand Down

0 comments on commit e89359c

Please sign in to comment.