summaryrefslogtreecommitdiff
path: root/http/http_connection.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-05-16 18:57:20 +0300
committerEd Tanous <ed@tanous.net>2023-05-19 18:52:09 +0300
commitad2b2eb94a9ec23a6c55f271adfdc989ffc9cb04 (patch)
tree10b89713aef2a7e79a39d5f079bc08a5c5105801 /http/http_connection.hpp
parenteea9c979498cdcd6df68c5fcdf28086e45466672 (diff)
downloadbmcweb-ad2b2eb94a9ec23a6c55f271adfdc989ffc9cb04.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. This patchset was previously reverted because of a regression, but this regression is fixed in 63529. Tested on previous commit: 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> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1d1bf01a5277ff1bc953b15d9fc410e10f941e70
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 24af031e81..213960214f 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_structured())
{
using http_helpers::ContentType;
std::array<ContentType, 3> allowed{