From e3fa5f4ae520451a99e28cc84663d075e298b399 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Thu, 11 Sep 2025 13:22:31 +0200 Subject: [PATCH] HTTP: send http status `accepted` where appropriate This better reflects the request handling, since the headers are sent before the request is fully processed. This status code just indicates that we successfully accepted the request but is not guaranteed that all the subsequent actions will also be successful. --- lib/remote/actionshandler.cpp | 2 +- lib/remote/deleteobjecthandler.cpp | 2 +- lib/remote/modifyobjecthandler.cpp | 2 +- lib/remote/objectqueryhandler.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/remote/actionshandler.cpp b/lib/remote/actionshandler.cpp index 187847843..889b487b6 100644 --- a/lib/remote/actionshandler.cpp +++ b/lib/remote/actionshandler.cpp @@ -120,7 +120,7 @@ bool ActionsHandler::HandleRequest( Dictionary::Ptr result = new Dictionary{{"results", new ValueGenerator{objs, generatorFunc}}}; result->Freeze(); - response.result(http::status::ok); + response.result(http::status::accepted); HttpUtility::SendJsonBody(response, params, result, yc); return true; diff --git a/lib/remote/deleteobjecthandler.cpp b/lib/remote/deleteobjecthandler.cpp index f59bc04fc..4414b0e21 100644 --- a/lib/remote/deleteobjecthandler.cpp +++ b/lib/remote/deleteobjecthandler.cpp @@ -130,7 +130,7 @@ bool DeleteObjectHandler::HandleRequest( Dictionary::Ptr result = new Dictionary{{"results", new ValueGenerator{objs, generatorFunc}}}; result->Freeze(); - response.result(http::status::ok); + response.result(http::status::accepted); HttpUtility::SendJsonBody(response, params, result, yc); return true; diff --git a/lib/remote/modifyobjecthandler.cpp b/lib/remote/modifyobjecthandler.cpp index dca08961f..3cc76cbae 100644 --- a/lib/remote/modifyobjecthandler.cpp +++ b/lib/remote/modifyobjecthandler.cpp @@ -178,7 +178,7 @@ bool ModifyObjectHandler::HandleRequest( Dictionary::Ptr result = new Dictionary{{"results", new ValueGenerator{objs, generatorFunc}}}; result->Freeze(); - response.result(http::status::ok); + response.result(http::status::accepted); HttpUtility::SendJsonBody(response, params, result, yc); return true; diff --git a/lib/remote/objectqueryhandler.cpp b/lib/remote/objectqueryhandler.cpp index acb904b6c..3691b2fb6 100644 --- a/lib/remote/objectqueryhandler.cpp +++ b/lib/remote/objectqueryhandler.cpp @@ -321,7 +321,7 @@ bool ObjectQueryHandler::HandleRequest( Dictionary::Ptr results = new Dictionary{{"results", new ValueGenerator{objs, generatorFunc}}}; results->Freeze(); - response.result(http::status::ok); + response.result(http::status::accepted); HttpUtility::SendJsonBody(response, params, results, yc); return true;