Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 0a9a1bd

Browse files
committed
feat: add prelight method
1 parent 8b71a85 commit 0a9a1bd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

controllers/prelight.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
#include "prelight.h"
22

3-
// Add definition of your processing function here
3+
void prelight::handlePrelight(
4+
const HttpRequestPtr &req,
5+
std::function<void(const HttpResponsePtr &)> &&callback) {
6+
auto resp = drogon::HttpResponse::newHttpResponse();
7+
resp->setStatusCode(drogon::HttpStatusCode::k200OK);
8+
resp->addHeader("Access-Control-Allow-Origin", "*");
9+
resp->addHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
10+
resp->addHeader("Access-Control-Allow-Headers", "*");
11+
callback(resp);
12+
}
13+

0 commit comments

Comments
 (0)