Skip to content

Commit

Permalink
formatting pass
Browse files Browse the repository at this point in the history
  • Loading branch information
confluence committed May 8, 2024
1 parent 1ea24bf commit 547974b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/HttpServer/HttpServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ void HttpServer::RegisterRoutes() {
const auto& object_type = elem.first;
app.get(fmt::format("{}/api/database/list/{}s", _url_prefix, object_type),
[&](auto res, auto req) { HandleGetObjectList(object_type, res, req); });
app.get(fmt::format("{}/api/database/{}s", _url_prefix, object_type), [&](auto res, auto req) { HandleGetObjects(object_type, res, req); });
app.get(
fmt::format("{}/api/database/{}/:name", _url_prefix, object_type), [&](auto res, auto req) { HandleGetObject(object_type, res, req); });
app.put(fmt::format("{}/api/database/{}", _url_prefix, object_type), [&](auto res, auto req) { HandleSetObject(object_type, res, req); });
app.del(fmt::format("{}/api/database/{}", _url_prefix, object_type), [&](auto res, auto req) { HandleClearObject(object_type, res, req); });
app.get(fmt::format("{}/api/database/{}s", _url_prefix, object_type),
[&](auto res, auto req) { HandleGetObjects(object_type, res, req); });
app.get(fmt::format("{}/api/database/{}/:name", _url_prefix, object_type),
[&](auto res, auto req) { HandleGetObject(object_type, res, req); });
app.put(fmt::format("{}/api/database/{}", _url_prefix, object_type),
[&](auto res, auto req) { HandleSetObject(object_type, res, req); });
app.del(fmt::format("{}/api/database/{}", _url_prefix, object_type),
[&](auto res, auto req) { HandleClearObject(object_type, res, req); });
}
} else {
app.get(fmt::format("{}/api/database/*", _url_prefix), [&](auto res, auto req) { NotImplemented(res, req); });
Expand Down
6 changes: 3 additions & 3 deletions src/Main/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ int main(int argc, char* argv[]) {
spdlog::critical("Custom url prefix is not allowed to start with '/'");
carta::logger::FlushLogFile();
return 1;
}
}
url_prefix = fmt::format("/{}", carta_url_prefix);
for (auto it = url_prefix.begin(); it < url_prefix.end(); it++) {
int iit = int(*it);
if ((iit < 48 || (iit < 65 && iit > 57) || (iit > 90 && iit < 97) || iit > 122) && // [0-9], [A-Z], [a-z]
(iit != 43 && iit != 45 && iit != 47 && iit != 64 && iit != 95) // +, -, /, @, _
) {
(iit != 43 && iit != 45 && iit != 47 && iit != 64 && iit != 95) // +, -, /, @, _
) {
spdlog::critical("Custom prefix must be the following characters: [0-9], [A-Z], [a-z], +, -, /, @, _");
carta::logger::FlushLogFile();
return 1;
Expand Down

0 comments on commit 547974b

Please sign in to comment.