mas: TestAdminUserDevicesDelete

This commit is contained in:
Roman Isaev 2025-01-15 13:02:28 +00:00
parent f1de5aa838
commit 0db7647f46
No known key found for this signature in database
GPG key ID: 7BE2B6A6C89AEC7F
2 changed files with 108 additions and 2 deletions

View file

@ -720,11 +720,13 @@ func AdminUserDevicesDelete(
}
userID := vars["userID"]
if req.Body == nil {
return util.MessageResponse(http.StatusBadRequest, "body is required")
}
var payload struct {
Devices []string `json:"devices"`
}
defer req.Body.Close() // nolint: errcheck
if err = json.NewDecoder(req.Body).Decode(&payload); err != nil {
logger.WithError(err).Error("unable to decode device deletion request")
return util.JSONResponse{
@ -732,6 +734,7 @@ func AdminUserDevicesDelete(
JSON: spec.InternalServerError{},
}
}
defer req.Body.Close() // nolint: errcheck
{
// XXX: this response struct can completely removed everywhere as it doesn't