Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug? 注册default_handler会覆盖RESTFul接口应该能匹配到的路径. #679

Open
Tsukyi1230 opened this issue Dec 21, 2024 · 2 comments
Assignees

Comments

@Tsukyi1230
Copy link

No description provided.

@Tsukyi1230
Copy link
Author

Tsukyi1230 commented Dec 21, 2024

#include <async_simple/coro/Lazy.h>
#include <format>
#include <iostream>
#include <ylt/coro_http/coro_http_server.hpp>

using namespace coro_http;
async_simple::coro::Lazy<void> handleDefault(request &req, response &res)
{
    std::cout << "default\n";
    co_return;
}

void handleCheck(request &req, response &res)
{
    std::cout << std::format("id = {}\n", req.params_["id"]);
}


int main()
{
    coro_http_server server(2, 8443);

    server.set_http_handler<HEAD, POST, GET>("/check/:id", handleCheck);
    server.set_default_handler(handleDefault);
    server.sync_start();
}

环境:
clang++ -v
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

@Tsukyi1230 Tsukyi1230 changed the title bug bug? 注册default_handler会覆盖RESTFul接口应该能匹配到的路径. Dec 21, 2024
@qicosmos
Copy link
Owner

@helintongh 看一下这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants