summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-01-29 08:30:06 +0300
committerEd Tanous <ed@tanous.net>2024-02-06 15:49:27 +0300
commit6fb96ce33d221a4cfa20d156eff5a3166ecb2661 (patch)
treee6fc343c39f3d60d25fa870533cae96886cc0a37 /http
parentf78fc98df3225e36a8abe865179a20b27e01d487 (diff)
downloadbmcweb-6fb96ce33d221a4cfa20d156eff5a3166ecb2661.tar.xz
Make tests not require body interaction
The muitipart test interacts with some significant details of the response class. This was largely only done because Request lacked an addHeader method that Request already had. Add addHeader() method to the Request class, and adapt multipart unit tests to use it. Tested: Unit tests pass. Unit test only changes. Change-Id: Icb3b92dce6d17011ae0063a962678173b1b01a87 Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'http')
-rw-r--r--http/http_request.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/http/http_request.hpp b/http/http_request.hpp
index e375f2888b..7cefb7d912 100644
--- a/http/http_request.hpp
+++ b/http/http_request.hpp
@@ -55,6 +55,16 @@ struct Request
Request& operator=(Request&&) = default;
~Request() = default;
+ void addHeader(std::string_view key, std::string_view value)
+ {
+ req.insert(key, value);
+ }
+
+ void addHeader(boost::beast::http::field key, std::string_view value)
+ {
+ req.insert(key, value);
+ }
+
boost::beast::http::verb method() const
{
return req.method();