Skip to content

can I pass parameters in RestClient->Process(fun)? #152

Description

@bethebest0622

I read the async demo, it's very easy and elegant.

void fun(Context& ctx) {
  auto reply = ctx.Get("http://jsonplaceholder.typicode.com/posts/1");
  auto json = reply->GetBodyAsString();
}
rest_client->Process(fun);

but, can i pass parameters into the process function like this:

void fun(Context& ctx, const std::string & url) {
  auto reply = ctx.Get(url);
  auto json = reply->GetBodyAsString();
}

int main() {
  rest_client->Process(fun, "http://jsonplaceholder.typicode.com/posts/1");
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions