1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 00:03:12 +02:00

relay/api: return HTTP error 404 instead of 400 when the buffer is not found in resources completion and input

This commit is contained in:
Sébastien Helleu
2025-11-13 07:12:55 +01:00
parent 69d47b68f5
commit e6646d1ef1
4 changed files with 19 additions and 8 deletions
@@ -622,7 +622,6 @@ TEST(RelayApiProtocolWithClient, CbCompletion)
/* error: no body */
test_client_recv_http ("POST /api/completion", NULL, NULL);
WEE_CHECK_HTTP_CODE(400, "Bad Request");
STRCMP_EQUAL("HTTP/1.1 400 Bad Request\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Content-Type: application/json; charset=utf-8\r\n"
@@ -636,8 +635,7 @@ TEST(RelayApiProtocolWithClient, CbCompletion)
NULL,
"{\"buffer_name\": \"invalid\", "
"\"command\": \"test\"}");
WEE_CHECK_HTTP_CODE(400, "Bad Request");
STRCMP_EQUAL("HTTP/1.1 400 Bad Request\r\n"
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Content-Type: application/json; charset=utf-8\r\n"
"Content-Length: 40\r\n"
@@ -717,7 +715,7 @@ TEST(RelayApiProtocolWithClient, CbInput)
NULL,
"{\"buffer_name\": \"invalid\", "
"\"command\": \"/print test\"}");
STRCMP_EQUAL("HTTP/1.1 400 Bad Request\r\n"
STRCMP_EQUAL("HTTP/1.1 404 Not Found\r\n"
"Access-Control-Allow-Origin: *\r\n"
"Content-Type: application/json; charset=utf-8\r\n"
"Content-Length: 40\r\n"