diff --git a/node/src/BaseClient.ts b/node/src/BaseClient.ts index 0ff1da3d72..2f1be67495 100644 --- a/node/src/BaseClient.ts +++ b/node/src/BaseClient.ts @@ -1649,8 +1649,7 @@ export class BaseClient { * * @param key - The key of the hash. * @param field - The field in the hash stored at `key` to retrieve from the database. - * @param decoder - (Optional) {@link Decoder} type which defines how to handle the response. - * If not set, the {@link BaseClientConfiguration.defaultDecoder|default decoder} will be used. + * @param options - (Optional) See {@link DecoderOption}. * @returns the value associated with `field`, or null when `field` is not present in the hash or `key` does not exist. * * @example @@ -1671,11 +1670,9 @@ export class BaseClient { public async hget( key: GlideString, field: GlideString, - decoder?: Decoder, + options?: DecoderOption, ): Promise { - return this.createWritePromise(createHGet(key, field), { - decoder: decoder, - }); + return this.createWritePromise(createHGet(key, field), options); } /** Sets the specified fields to their respective values in the hash stored at `key`. diff --git a/node/tests/SharedTests.ts b/node/tests/SharedTests.ts index aa3ecb2600..25a44b5f92 100644 --- a/node/tests/SharedTests.ts +++ b/node/tests/SharedTests.ts @@ -1356,14 +1356,16 @@ export function runBaseTests(config: { ); //hget with binary buffer - expect(await client.hget(key, field1, Decoder.Bytes)).toEqual( - valueEncoded, - ); - expect(await client.hget(key, field2, Decoder.Bytes)).toEqual( - valueEncoded, - ); expect( - await client.hget(key, "nonExistingField", Decoder.Bytes), + await client.hget(key, field1, { decoder: Decoder.Bytes }), + ).toEqual(valueEncoded); + expect( + await client.hget(key, field2, { decoder: Decoder.Bytes }), + ).toEqual(valueEncoded); + expect( + await client.hget(key, "nonExistingField", { + decoder: Decoder.Bytes, + }), ).toEqual(null); }, protocol); },