add info endpoint

This commit is contained in:
Jeff Raymakers
2025-02-25 10:27:33 -08:00
parent b0919a3c4f
commit 68281378a2
2 changed files with 14 additions and 1 deletions

View File

@@ -133,6 +133,9 @@ shared_ptr<DatabaseInstance> HttpServer::LockDatabaseInstance() {
}
void HttpServer::Run() {
server.Get("/info", [&](const httplib::Request &req, httplib::Response &res) {
HandleGetInfo(req, res);
});
server.Get("/localEvents",
[&](const httplib::Request &req, httplib::Response &res) {
HandleGetLocalEvents(req, res);
@@ -161,6 +164,15 @@ void HttpServer::Run() {
server.listen("localhost", local_port);
}
void HttpServer::HandleGetInfo(const httplib::Request &req,
httplib::Response &res) {
res.set_header("Access-Control-Allow-Origin", "*");
res.set_header("X-DuckDB-Version", DuckDB::LibraryVersion());
res.set_header("X-DuckDB-Platform", DuckDB::Platform());
res.set_header("X-DuckDB-UI-Extension-Version", UI_EXTENSION_VERSION);
res.set_content("", "text/plain");
}
void HttpServer::HandleGetLocalEvents(const httplib::Request &req,
httplib::Response &res) {
res.set_chunked_content_provider(