summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crow/include/crow/http_connection.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/crow/include/crow/http_connection.h b/crow/include/crow/http_connection.h
index 6f44186..78ee70b 100644
--- a/crow/include/crow/http_connection.h
+++ b/crow/include/crow/http_connection.h
@@ -447,6 +447,17 @@ class Connection
{
res.body() = std::string(res.reason());
}
+
+ if (res.result() == boost::beast::http::status::no_content)
+ {
+ // Boost beast throws if content is provided on a no-content
+ // response. Ideally, this would never happen, but in the case that
+ // it does, we don't want to throw.
+ BMCWEB_LOG_CRITICAL
+ << "Response content provided but code was no-content";
+ res.body().clear();
+ }
+
res.addHeader(boost::beast::http::field::server, serverName);
res.addHeader(boost::beast::http::field::date, getCachedDateStr());
OpenPOWER on IntegriCloud