mirror of https://git.48k.eu/ogserver
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.master
parent
351069b591
commit
b2c8c9d9ab
|
@ -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);
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ int og_client_state_process_payload_rest(struct og_client *cli);
|
|||
enum og_rest_method {
|
||||
OG_METHOD_GET = 0,
|
||||
OG_METHOD_POST,
|
||||
OG_METHOD_DELETE,
|
||||
OG_METHOD_NO_HTTP
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue