mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-22 22:11:22 +00:00
fix!: Ensure data in response is always empty on error (#24971)
This commit is contained in:
1 parent
d78c6facab
commit
a6b36051f0
3 files changed
+10
-9
No files matched your search
+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