Skip to content

Commit 5a03e4d

Browse files
committed
add test case when body is null
1 parent 98c4f40 commit 5a03e4d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/core/server/elasticsearch/client/configure_client.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,32 @@ describe('configureClient', () => {
349349
]
350350
`);
351351
});
352+
353+
it('when request body is null', () => {
354+
const client = configureClient(
355+
createFakeConfig({
356+
logQueries: true,
357+
}),
358+
{ logger, scoped: false }
359+
);
360+
361+
const response = createResponseWithBody(null);
362+
363+
client.emit('response', null, response);
364+
expect(loggingSystemMock.collect(logger).debug).toMatchInlineSnapshot(`
365+
Array [
366+
Array [
367+
"200
368+
GET /foo?hello=dolly",
369+
Object {
370+
"tags": Array [
371+
"query",
372+
],
373+
},
374+
],
375+
]
376+
`);
377+
});
352378
});
353379

354380
it('properly encode queries', () => {

0 commit comments

Comments
 (0)