1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 19:23:13 +02:00

relay/api: always set "body_type" and "body" (null if there is no body) in websocket frame

This commit is contained in:
Sébastien Helleu
2024-06-29 19:37:44 +02:00
parent 2184af9d99
commit f8f6e100d0
5 changed files with 63 additions and 36 deletions
+8 -8
View File
@@ -174,17 +174,17 @@ relay_api_msg_send_json_internal (struct t_relay_client *client,
cJSON_AddItemToObject (
json, "request_body",
(client->http_req->body) ?
cJSON_Parse (client->http_req->body) :cJSON_CreateNull ());
cJSON_Parse (client->http_req->body) : cJSON_CreateNull ());
free (request);
}
}
if (body_type)
{
cJSON_AddItemToObject (json, "body_type",
cJSON_CreateString (body_type));
}
if (json_body)
cJSON_AddItemToObject (json, "body", json_body);
cJSON_AddItemToObject (
json, "body_type",
(body_type) ?
cJSON_CreateString (body_type) : cJSON_CreateNull ());
cJSON_AddItemToObject (
json, "body",
(json_body) ? json_body : cJSON_CreateNull ());
string = cJSON_PrintUnformatted (json);
num_bytes = relay_client_send (
client,