From 6fb96ce33d221a4cfa20d156eff5a3166ecb2661 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Sun, 28 Jan 2024 21:30:06 -0800 Subject: 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 --- http/http_request.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'http') 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(); -- cgit v1.2.3