Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename argument for the sessionProvider option for the Node HTTP client #1210

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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