summaryrefslogtreecommitdiff
path: root/include/cors_preflight.hpp
blob: 844fd3862eab4dc84357f63b7938d596987fa259 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

#include <app.hpp>
#include <http_request.hpp>
#include <http_response.hpp>

namespace cors_preflight
{
void requestRoutes(App& app)
{
    BMCWEB_ROUTE(app, "<str>")
        .methods(boost::beast::http::verb::options)(
            [](const crow::Request&, crow::Response& res, const std::string&) {
                // An empty body handler that simply returns the headers bmcweb
                // uses This allows browsers to do their CORS preflight checks
                res.end();
            });
}
} // namespace cors_preflight