Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Requests! #10

Open
CyborgHead opened this issue Nov 21, 2015 · 1 comment
Open

Fixed Requests! #10

CyborgHead opened this issue Nov 21, 2015 · 1 comment

Comments

@CyborgHead
Copy link

How is it possible to make dynamic requests using this library?

The following code snippets will NOT work since you made the URL of the GET Request and the Body of the POST Requests Constant.

// GET Request.
int statusCode = client.get("/api/myservice/id=" + id, &response);

// POST Request.
char postdata = /* Some data from function parameter, for example. */;
int statusCode = client.post(""/api/myservice/id", postdata , &response);

@sbonkosky
Copy link

@CyborgHead Build your request in a String object and then use .c_str() to convert to a const char*, like so:

String data = "/api/myservice/id=" + id;
int statusCode = client.post("/api/myservice/id", data.c_str() , &response);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants