libhv icon indicating copy to clipboard operation
libhv copied to clipboard

Feature requested: Websocket support open with params

Open qZhang88 opened this issue 1 year ago • 2 comments

The open function of WebSocketClient does not support param, could that be supported? I think the change is small.

change function definition from

int open(const char* url, const http_headers& headers = DefaultHeaders);

to

int open(const char* url,
         const http_headers& headers = DefaultHeaders,
         const QueryParams& params = QueryParams());

update implementation with one line, just set query_params before ParseUrl

+    http_req_->query_params = params;
     http_req_->ParseUrl();

qZhang88 avatar Oct 16 '24 08:10 qZhang88

可以在open前通过setHttpRequest接口来设置http_req_的

ithewei avatar Oct 18 '24 08:10 ithewei

明白。嗯,不过我是直接把param拼接到url,也是一样的。

qZhang88 avatar Oct 18 '24 13:10 qZhang88

明白。嗯,不过我是直接把param拼接到url,也是一样的。

是的,也是可以的

ithewei avatar Oct 21 '24 03:10 ithewei