Skip to content

Commit

Permalink
Update docs about network task 'prepare' function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim committed Jan 23, 2025
1 parent 5752663 commit 21b48e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/about-connection-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void prepare_func(WFHttpTask *task)
int some_function()
{
WFHttpTask *task = WFTaskFactory::create_http_task(...);
static_cast<WFClientTask<HttpRequest, HttpResponse>>(task)->set_prepare(prepare_func);
task->set_prepare(prepare_func);
...
}
~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/bugs.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void f()
void f();
{
auto *task = WFTaskFactory::create_http_task("https://sogou/index.html", 0, 0, nullptr);
static_cast<WFClientTask<protocol::HttpRequest, protocol::HttpResponse> *>(task)->set_prepare([](WFHttpTask *task){
task->set_prepare([](WFHttpTask *task){
auto *t = static_cast<WFComplexClientTask<protocol::HttpRequest, protocol::HttpResponse> *>(task);
task->get_req()->set_header_pair("Host", t->get_current_uri()->host); // 这里得到实际uri里的host。
});
Expand Down
2 changes: 1 addition & 1 deletion docs/en/about-connection-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void prepare_func(WFHttpTask *task)
int some_function()
{
WFHttpTask *task = WFTaskFactory::create_http_task(...);
static_cast<WFClientTask<HttpRequest, HttpResponse>>(task)->set_prepare(prepare_func);
task->set_prepare(prepare_func);
...
}
~~~
Expand Down

0 comments on commit 21b48e6

Please sign in to comment.