-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathController.cpp
More file actions
55 lines (47 loc) · 2.1 KB
/
Copy pathController.cpp
File metadata and controls
55 lines (47 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2026 Kirill Sergeev, Nikolay Sugonyako, Andrey Agarkov, Gleb Safyannikov
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of lightlib.
*
* lightlib is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* lightlib is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with lightlib; if not, see <https://www.gnu.org/licenses/>.
*/
#include "../include/lightlib/App/Http/Controllers/Controller.hpp"
using namespace lightlib;
boost::asio::awaitable<void> Controller::show(const Request& req, Response& res, const Params& params) {
res.result(http::status::method_not_allowed);
co_return;
}
boost::asio::awaitable<void> Controller::store(const Request& req, Response& res, const Params& params) {
res.result(http::status::method_not_allowed);
co_return;
}
boost::asio::awaitable<void> Controller::delete_(const Request& req, Response& res, const Params& params) {
res.result(http::status::method_not_allowed);
co_return;
}
boost::asio::awaitable<void> Controller::update(const Request& req, Response& res, const Params& params) {
res.result(http::status::method_not_allowed);
co_return;
}
void Controller::setCors(const Request& req, Response& res) {
res.set(http::field::access_control_allow_origin, "*");
res.set(http::field::access_control_allow_credentials, "true");
res.set(http::field::access_control_allow_methods, "GET, POST, PUT, DELETE, OPTIONS");
res.set(http::field::access_control_allow_headers, "*");
res.set(http::field::access_control_expose_headers, "Set-Cookie");
}
void Controller::setCorsHeaders(const Request& req, Response& res) {
this->setCors(req, res);
}