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

SetUri not working #13

Closed
anctsys opened this issue Nov 30, 2019 · 3 comments
Closed

SetUri not working #13

anctsys opened this issue Nov 30, 2019 · 3 comments
Labels

Comments

@anctsys
Copy link

anctsys commented Nov 30, 2019

Hi

Thank you for this great library.
I work on ESP8266 (D1 mini)
setUri not working with
String uri = "/mytest";
uri.c_str()
or
String uri = "/mytest";
char uri_buf[uri.length()+1];
uri.toCharArray(uri_buf, uri.length()+1);

The server not redirect to /mytest (error 404)

page.setUri(uri.c_str()); elm.setMold(PSTR( "<html>" "<body>" "<h2>{{ROOT}}</h2>" "</body>" "</html>")); elm.addToken("ROOT", rootPage);

But when I using TEST_PAGE.setUri("/mytest"); the sketch work properly.

Best regards

@Hieromon
Copy link
Owner

Hieromon commented Dec 2, 2019

PageBulder does not hold an instance of a page URI. A phenomenon similar to your experience will occur if the uri instance does not exist when the page accessed.
For example, if String uri is a local variable in some function of the sketch, an instance of the uri is lost at exiting from the function.
This structure of PageBulder is undesirable, so I will need to improve it.

Hieromon added a commit that referenced this issue Dec 4, 2019
@Hieromon
Copy link
Owner

Hieromon commented Dec 4, 2019

Fixed. 62b2ece

@Hieromon Hieromon closed this as completed Dec 4, 2019
@anctsys
Copy link
Author

anctsys commented Dec 4, 2019

Thank you
Do you plan this evolution in your development.

@Hieromon Hieromon added the bug label Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants