drogon icon indicating copy to clipboard operation
drogon copied to clipboard

Add http method conversion function

Open fantasy-peak opened this issue 2 years ago • 1 comments

fantasy-peak avatar Jun 30 '23 07:06 fantasy-peak

作为服务端时候,http 方法被配置在配置文件中, 需要一个转换函数将 str 转换成 HttpMethod, 打印配置时候需要将HttpMethod 转换成str

    app().registerHandler(
        "/hello_user",
        [](const HttpRequestPtr &req,
           std::function<void(const HttpResponsePtr &)> &&callback) {
            callback(resp);
        },
        {to_http_method("GET")});

nqf avatar Jun 30 '23 07:06 nqf