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

[FIX] jetstreamManager(checkAPI) overrode the checkAPI option incorrectly #672

Merged
merged 1 commit into from
Mar 26, 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
8 changes: 6 additions & 2 deletions jetstream/jsclient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2023 The NATS Authors
* Copyright 2022-2024 The NATS Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -159,9 +159,13 @@ export class JetStreamClientImpl extends BaseApiClient
}

jetstreamManager(checkAPI?: boolean): Promise<JetStreamManager> {
if (checkAPI === undefined) {
checkAPI = (this.opts as JetStreamManagerOptions).checkAPI;
}
const opts = Object.assign(
{ checkAPI },
{},
this.opts,
{ checkAPI },
) as JetStreamManagerOptions;
return this.nc.jetstreamManager(opts);
}
Expand Down
7 changes: 4 additions & 3 deletions jetstream/tests/jsm_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2023 The NATS Authors
* Copyright 2021-2024 The NATS Authors
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -2712,7 +2712,8 @@ Deno.test("jsm - api check not ok", async () => {
await nc.jetstream().jetstreamManager(false);
await nc.jetstream({ checkAPI: false }).jetstreamManager();
await nc.jetstream({ checkAPI: false }).jetstreamManager(true);
assertEquals(count, 0);
await nc.jetstream().jetstreamManager();
assertEquals(count, 2);

await cleanup(ns, nc);
});
Expand All @@ -2732,7 +2733,7 @@ Deno.test("jsm - api check ok", async () => {
await nc.jetstream({ checkAPI: true }).jetstreamManager();
await nc.jetstream({ checkAPI: true }).jetstreamManager(false);

assertEquals(count, 3);
assertEquals(count, 4);
await cleanup(ns, nc);
});

Expand Down
Loading