Skip to content

Commit a7718eb

Browse files
authored
Merge pull request #366 from ml054/v5.2
RDBC-693 Node.js client should be able to handle 404 in GetDatabaseRe…
2 parents f77c309 + 84c988f commit a7718eb

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/ServerWide/Operations/GetDatabaseRecordOperation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class GetDatabaseRecordCommand extends RavenCommand<DatabaseRecordWithEta
5151

5252
public async setResponseAsync(bodyStream: stream.Stream, fromCache: boolean): Promise<string> {
5353
if (!bodyStream) {
54-
this._throwInvalidResponse();
54+
return null;
5555
}
5656

5757
let body: string = null;

test/Ported/Issues/RDBC_693.ts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { testContext, disposeTestDocumentStore } from "../../Utils/TestUtil";
2+
3+
import {
4+
IDocumentStore, DocumentChange, GetDatabaseRecordOperation,
5+
} from "../../../src";
6+
import { User } from "../../Assets/Entities";
7+
import { AsyncQueue } from "../../Utils/AsyncQueue";
8+
import { throwError } from "../../../src/Exceptions";
9+
import { assertThat, assertThrows } from "../../Utils/AssertExtensions";
10+
11+
describe("RDBC_693", function () {
12+
13+
let store: IDocumentStore;
14+
15+
beforeEach(async function () {
16+
store = await testContext.getDocumentStore();
17+
});
18+
19+
afterEach(async () =>
20+
await disposeTestDocumentStore(store));
21+
22+
it("can handle 404 in GetDatabaseRecordOperation", async () => {
23+
const dbRecord = await store.maintenance.server.send(new GetDatabaseRecordOperation("DB_WHICH_DOESNT_EXIST"));
24+
assertThat(dbRecord)
25+
.isNull();
26+
});
27+
});

0 commit comments

Comments
 (0)