diff options
author | Ed Tanous <edtanous@google.com> | 2022-03-17 18:53:00 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-08-03 23:37:29 +0300 |
commit | f610caaeaebc3b6aeaef3cd293ae6e43339af315 (patch) | |
tree | 637d445fd6b7045064b8a771cf24e2e0a09ae1af /http | |
parent | 1d8d9a3f8d6f7be032cae9f2d89c1048d7dfbadb (diff) | |
download | bmcweb-f610caaeaebc3b6aeaef3cd293ae6e43339af315.tar.xz |
Remove jsonMode method
The jsonMode method is a single line, that basically only sets the
content type, and is only called from one place. In all other cases we
set the content-type directly from a header, so we should do the same
here.
Tested:
curl --insecure -vvv --user root:0penBmc https://192.168.7.2/redfish/v1
returns < Content-Type: application/json
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I82f6fcf1b574192620ac7b29f97cdd01334c18c4
Diffstat (limited to 'http')
-rw-r--r-- | http/http_connection.hpp | 3 | ||||
-rw-r--r-- | http/http_response.hpp | 6 |
2 files changed, 2 insertions, 7 deletions
diff --git a/http/http_connection.hpp b/http/http_connection.hpp index feea815832..d061973728 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -459,7 +459,8 @@ class Connection : } else { - res.jsonMode(); + res.addHeader(boost::beast::http::field::content_type, + "application/json"); res.body() = res.jsonValue.dump( 2, ' ', true, nlohmann::json::error_handler_t::replace); } diff --git a/http/http_response.hpp b/http/http_response.hpp index d06c65dd82..71d3377461 100644 --- a/http/http_response.hpp +++ b/http/http_response.hpp @@ -187,11 +187,5 @@ struct Response bool completed = false; std::function<void(Response&)> completeRequestHandler; std::function<bool()> isAliveHelper; - - // In case of a JSON object, set the Content-Type header - void jsonMode() - { - addHeader("Content-Type", "application/json"); - } }; } // namespace crow |