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

Registered functions return String instead of int #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

areyalp
Copy link

@areyalp areyalp commented Apr 12, 2020

Now registered function methods in the code return String instead of int. For instance, it would allow the responses to be more complex, now it can be returned a response containing String, int casted to String or even a JSON or XML. Therefore, it lets you reply with more than one simple integer.

E.g:

void setup() {
.
.
.
rest.function("test", testFunction);
}

String testFunction(String params) {
String strJson= "{\"key1\" : \"value1\", \"key2\" : \"value2\"}";
return strJson;
}

I did a test with the following result:

image

Now registered function methods in the code return String instead of int. For instance, it would allow the responses to be more complex, now it can be returned a response containing String, int casted to String or even a JSON or XML. Therefore, it lets you reply with more than one simple integer.
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

Successfully merging this pull request may close these issues.

1 participant