mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Don't send nulls
This commit is contained in:
parent
9a541a03fc
commit
525c9e054f
2 changed files with 16 additions and 9 deletions
|
@ -112,15 +112,22 @@ func QueryKeys(req *http.Request, keyAPI api.KeyInternalAPI) util.JSONResponse {
|
||||||
Timeout: r.GetTimeout(),
|
Timeout: r.GetTimeout(),
|
||||||
// TODO: Token?
|
// TODO: Token?
|
||||||
}, &queryRes)
|
}, &queryRes)
|
||||||
|
res := map[string]interface{}{
|
||||||
|
"device_keys": queryRes.DeviceKeys,
|
||||||
|
"failures": queryRes.Failures,
|
||||||
|
}
|
||||||
|
if k := queryRes.MasterKeys; k != nil {
|
||||||
|
res["master_keys"] = k
|
||||||
|
}
|
||||||
|
if k := queryRes.SelfSigningKeys; k != nil {
|
||||||
|
res["self_signing_keys"] = k
|
||||||
|
}
|
||||||
|
if k := queryRes.UserSigningKeys; k != nil {
|
||||||
|
res["user_signing_keys"] = k
|
||||||
|
}
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: 200,
|
Code: 200,
|
||||||
JSON: map[string]interface{}{
|
JSON: res,
|
||||||
"device_keys": queryRes.DeviceKeys,
|
|
||||||
"master_keys": queryRes.MasterKeys,
|
|
||||||
"self_signing_keys": queryRes.SelfSigningKeys,
|
|
||||||
"user_signing_keys": queryRes.UserSigningKeys,
|
|
||||||
"failures": queryRes.Failures,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,8 @@ func QueryDeviceKeys(
|
||||||
Code: 200,
|
Code: 200,
|
||||||
JSON: struct {
|
JSON: struct {
|
||||||
DeviceKeys interface{} `json:"device_keys"`
|
DeviceKeys interface{} `json:"device_keys"`
|
||||||
MasterKeys interface{} `json:"master_keys"`
|
MasterKeys interface{} `json:"master_keys,omitempty"`
|
||||||
SelfSigningKeys interface{} `json:"self_signing_keys"`
|
SelfSigningKeys interface{} `json:"self_signing_keys,omitempty"`
|
||||||
}{
|
}{
|
||||||
queryRes.DeviceKeys,
|
queryRes.DeviceKeys,
|
||||||
queryRes.MasterKeys,
|
queryRes.MasterKeys,
|
||||||
|
|
Loading…
Reference in a new issue