Add "Retry-After" header for temporarily unavailable messages
Whenever the Redfish response is that a service is temporarily
unavailable, the "Retry-After" header is added with the same
value, so just set the header automatically with the response.
Tested:
Confirmed that the "Retry-After" header is set correctly with
the Redfish temporarily unavailable message.
Change-Id: I9c940be94d9d284b9633c5caa2ce71ade76d22d5
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index f82363b..e15c308 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -421,7 +421,6 @@
static const int TIME_OUT = 10;
if (csrMatcher)
{
- res.addHeader("Retry-After", std::to_string(TIME_OUT));
messages::serviceTemporarilyUnavailable(asyncResp->res,
std::to_string(TIME_OUT));
return;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 2eb00b6..0f4a902 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1875,7 +1875,6 @@
// Only allow one OnDemand Log request at a time
if (onDemandLogMatcher != nullptr)
{
- asyncResp->res.addHeader("Retry-After", "30");
messages::serviceTemporarilyUnavailable(asyncResp->res, "30");
return;
}
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index da88271..fde05ab 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -141,7 +141,6 @@
{
if (asyncResp)
{
- asyncResp->res.addHeader("Retry-After", "30");
messages::serviceTemporarilyUnavailable(asyncResp->res, "30");
}
return;
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index b9d72ea..bc4cba6 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -348,6 +348,7 @@
*/
void serviceTemporarilyUnavailable(crow::Response& res, const std::string& arg1)
{
+ res.addHeader("Retry-After", arg1);
res.result(boost::beast::http::status::service_unavailable);
addMessageToErrorJson(
res.jsonValue,