sogou / srpc

RPC framework based on C++ Workflow. Supports SRPC, Baidu bRPC, Tencent tRPC, thrift protocols.
Apache License 2.0
1.96k stars 385 forks source link

support ctx->set_http_code() in process(); #169

Closed holmes1412 closed 2 years ago

holmes1412 commented 2 years ago

Usage:

class ExampleServiceImpl : public Example::Service                                 
{                                                                                  
public:                                                                            
    void Echo(EchoRequest *req, EchoResponse *resp, RPCContext *ctx) override   
    {                                                                              
        if (req->name() != "workflow")
            ctx->set_http_code("404");
        else
            resp->set_message("Hi back"); 
    }                                                                              
};