xref: /openbmc/bmcweb/features/redfish/include/sub_request.hpp (revision fdf51f5c824273aafaa9262932735ca443db23eb)
1 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors
3 #pragma once
4 
5 #include "http_request.hpp"
6 
7 #include <boost/beast/http/verb.hpp>
8 
9 #include <string>
10 #include <string_view>
11 
12 namespace redfish
13 {
14 
15 class SubRequest
16 {
17   public:
18     explicit SubRequest(const crow::Request& req) :
19         url_(req.url().encoded_path()), method_(req.method())
20     {}
21 
22     std::string_view url() const
23     {
24         return url_;
25     }
26 
27     boost::beast::http::verb method() const
28     {
29         return method_;
30     }
31 
32   private:
33     std::string url_;
34     boost::beast::http::verb method_;
35 };
36 
37 } // namespace redfish
38