The listenKey parameter, used in the renewListenKey and closeListenKey methods, is not validated for its type before being used in API requests. This can lead to potential runtime errors if listenKey is not a valid string, causing failures or unexpected behavior when interacting with the API.
Problem:
The listenKey is being passed directly into API requests without validating if it's a string. This may cause issues if the listenKey is not properly validated, especially if a non-string value is provided.
Suggested Fix:
Add a type validation for listenKey to ensure that it is always a string before being used in API requests.
Example Fix:
// Before:
validateRequiredParameters({ listenKey });
// ToFix:
if (typeof listenKey !== 'string') {
throw new Error('ListenKey must be a string');
}
validateRequiredParameters({ listenKey });
Issue Description:
The
listenKey
parameter, used in therenewListenKey
andcloseListenKey
methods, is not validated for its type before being used in API requests. This can lead to potential runtime errors iflistenKey
is not a valid string, causing failures or unexpected behavior when interacting with the API.Problem:
The
listenKey
is being passed directly into API requests without validating if it's a string. This may cause issues if thelistenKey
is not properly validated, especially if a non-string value is provided.Suggested Fix:
Add a type validation for
listenKey
to ensure that it is always a string before being used in API requests.Example Fix: