mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-28 05:24:29 +00:00
fix!: Ensure data in response is always empty on error (#24971)
This commit is contained in:
+2
-1
@@ -121,7 +121,8 @@ function getObjectProperty<T>(object: KeyValue, key: string, defaultValue: NoInf
|
||||
}
|
||||
|
||||
function getResponse(request: KeyValue | string, data: KeyValue, error?: string): MQTTResponse {
|
||||
const response: MQTTResponse = {data, status: error ? 'error' : 'ok'};
|
||||
// On `error`, always return an empty `data` payload.
|
||||
const response: MQTTResponse = {data: error ? {} : data, status: error ? 'error' : 'ok'};
|
||||
|
||||
if (error) {
|
||||
response.error = error;
|
||||
|
||||
Reference in New Issue
Block a user