summaryrefslogtreecommitdiff
path: root/http/http_connection.hpp
diff options
context:
space:
mode:
authorLei YU <yulei.sh@bytedance.com>2023-04-19 10:09:07 +0300
committerEd Tanous <ed@tanous.net>2023-04-25 19:26:44 +0300
commit02e01b5108d46720a0b438c0d79952464320d954 (patch)
tree1fa746b114d4c4f329e8cf1944971609f8fe7bc4 /http/http_connection.hpp
parent8d01836c4c6db41bfd5e67be2a363f193cb4d0c5 (diff)
downloadbmcweb-02e01b5108d46720a0b438c0d79952464320d954.tar.xz
http_connection: Allow empty json objects
Currently http_connection will produce empty body in the response if the res.jsonValue is empty, including empty array, object. This makes the output confusing in case a response does contain an empty object or array. Change the code to print the json object even if it's empty object or array, so that the output is consistent with the `res.jsonValue`. Tested: With an OEM URL that returns empty array depending on the system config, the response becomes `[]` instead of empty. Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: Ie97378a2cffce7b1fd6586a56b6cfa7d5c476dc1
Diffstat (limited to 'http/http_connection.hpp')
-rw-r--r--http/http_connection.hpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index d5d02e545a..47f9432bde 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -342,7 +342,7 @@ class Connection :
res.setHashAndHandleNotModified();
- if (res.body().empty() && !res.jsonValue.empty())
+ if (res.body().empty() && !res.jsonValue.is_null())
{
using http_helpers::ContentType;
std::array<ContentType, 3> allowed{