summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-08-22 12:30:21 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-08-23 11:39:19 +0200
commitb2c8c9d9ab1cfaaf833f7e6ad318505df9a9ec36 (patch)
tree268869eb9b1b817dc7ae7265280010a7e5bc9e81 /src/rest.c
parent351069b5916da8770d48d22c7f80d1a52ff770ad (diff)
rest: support DELETE HTTP request method
Reuse endpoints in order to add deletion operation such as "/server". This way there is no need to declare a different if/else block in order to parse a new URI for the new "*/delete" endpoint. Current deletion operations are implemented using a different endpoint name such as "/client/delete", "/center/delete" with POST request method. Endpoints using "/delete" suffix may not be removed for backwards compatibility. Adding HTTP method DELETE support for endpoints such as "/center" or "/client" can use the already existing *_post_delete* functions.
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rest.c b/src/rest.c
index 2864de2..8f9c61e 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -5938,6 +5938,9 @@ int og_client_state_process_payload_rest(struct og_client *cli)
} else if (!strncmp(cli->buf, "POST", strlen("POST"))) {
method = OG_METHOD_POST;
cmd = cli->buf + strlen("POST") + 2;
+ } else if (!strncmp(cli->buf, "DELETE", strlen("DELETE"))) {
+ method = OG_METHOD_DELETE;
+ cmd = cli->buf + strlen("DELETE") + 2;
} else
return og_client_method_not_found(cli);