Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 3 | #include "app.hpp" |
| 4 | #include "http_request.hpp" |
| 5 | #include "http_response.hpp" |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 6 | |
| 7 | namespace cors_preflight |
| 8 | { |
Ed Tanous | b00dcc2 | 2021-02-23 12:52:50 -0800 | [diff] [blame] | 9 | inline void requestRoutes(App& app) |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 10 | { |
| 11 | BMCWEB_ROUTE(app, "<str>") |
| 12 | .methods(boost::beast::http::verb::options)( |
Ed Tanous | 104f09c | 2022-01-25 09:56:04 -0800 | [diff] [blame] | 13 | [](const crow::Request& /*req*/, |
| 14 | const std::shared_ptr<bmcweb::AsyncResp>&, const std::string&) { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 15 | // An empty body handler that simply returns the headers bmcweb |
| 16 | // uses This allows browsers to do their CORS preflight checks |
Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 17 | }); |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 18 | } |
| 19 | } // namespace cors_preflight |