$darkmode
request_stub.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
22 #pragma once
23 
24 #include <map> // for map<>
25 #include <stdexcept> // for logic_error
26 #include <string> // for string
27 
28 #include <cloe/handler.hpp> // for Request, RequestMethod, ContentType
29 
30 namespace oak {
31 
32 class RequestStub : public cloe::Request {
33  public:
34  cloe::RequestMethod method() const override { throw ERROR; }
35  cloe::ContentType type() const override { throw ERROR; }
36  const std::string& body() const override { throw ERROR; }
37  const std::string& uri() const override { throw ERROR; }
38  const std::string& endpoint() const override { throw ERROR; }
39  const std::map<std::string, std::string>& query_map() const override { throw ERROR; }
40 
41  private:
42  const std::logic_error ERROR = std::logic_error("using the request in any way is erroneous");
43 };
44 
45 } // namespace oak
Definition: handler.hpp:94
Definition: request_stub.hpp:32
const std::string & endpoint() const override
Definition: request_stub.hpp:38
const std::string & body() const override
Definition: request_stub.hpp:36
cloe::ContentType type() const override
Definition: request_stub.hpp:35
const std::map< std::string, std::string > & query_map() const override
Definition: request_stub.hpp:39
cloe::RequestMethod method() const override
Definition: request_stub.hpp:34
const std::string & uri() const override
Definition: request_stub.hpp:37
RequestMethod
Definition: handler.hpp:54
ContentType
Definition: handler.hpp:71