changeset 4361:7f1f3b79d991

mod_http_admin_api: Return new group object on successful creation
author Matthew Wild <mwild1@gmail.com>
date Wed, 20 Jan 2021 12:51:33 +0000
parents 76bec3f66b24
children 116c88c28532
files mod_http_admin_api/mod_http_admin_api.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_admin_api/mod_http_admin_api.lua	Tue Jan 19 20:36:41 2021 +0000
+++ b/mod_http_admin_api/mod_http_admin_api.lua	Wed Jan 20 12:51:33 2021 +0000
@@ -255,7 +255,12 @@
 	if not ok then
 		return 500;
 	end
-	return 200;
+
+	event.response.headers["Content-Type"] = json_content_type;
+	return json.encode({
+		id = group.id or group.name;
+		name = group.name;
+	});
 end
 
 function delete_group(event, group_id) --luacheck: ignore 212/event