Skip to content

Commit

Permalink
fix: do not log error for undefined reviver for string response
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cpaulve-1A authored and mrednic-1A committed Jul 8, 2024
1 parent 415f542 commit bd104b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@ama-sdk/core/src/fwk/api.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function getResponseReviver<T>(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) {
Expand Down

0 comments on commit bd104b4

Please sign in to comment.