From bd104b498ec448f8b594a6dd5ae35f8d17460db1 Mon Sep 17 00:00:00 2001 From: Corinne PAULVE Date: Mon, 1 Jul 2024 15:41:05 +0200 Subject: [PATCH] fix: do not log error for undefined reviver for string response In the case of simple response for a valid status code (for example number or string), the reviver is undefined. We should not log this scenario --- packages/@ama-sdk/core/src/fwk/api.helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@ama-sdk/core/src/fwk/api.helpers.ts b/packages/@ama-sdk/core/src/fwk/api.helpers.ts index 9b45f9276f..1405de7ca5 100644 --- a/packages/@ama-sdk/core/src/fwk/api.helpers.ts +++ b/packages/@ama-sdk/core/src/fwk/api.helpers.ts @@ -133,7 +133,7 @@ export function getResponseReviver(revivers: { [statusCode: number]: ReviverT if (typeof revivers === 'function' || typeof revivers === 'undefined') { return revivers; } - if (response.status && revivers[response.status]) { + if (response.status && Object.keys(revivers).indexOf(`${response.status}`) > -1) { return revivers[response.status]; } if (options?.disableFallback) {