Chat freely about anything...

User avatar
By brasta
#77497 I run web server on ESP-01 to control GPIO (input/output). To show you this Chrome trick I've attached LED to see visually what is surprising me. To turn ON LED we need just enter to this URL: , to turn off - URL: that is we can control LED sending HTTP GET requests.

Like you see in my video it’s enough to correct from 0 to 1 and BEFORE pressing Enter on the keyboard LED change his state. Web sniffer on the left shows that after URL edit we have GET request before it submitting. This behavior is on Chrome browser only and I can’t reproduce the same with Chrome and any other website
User avatar
By QuickFix
User avatar
By jankop
#77526 I think what you consider to be a Chrome trick is the wrong reaction of your program to HTTP queries. I estimate this is related to the favicon browser request. Different browsers may behave differently and therefore the error is only reflected on Chrome.
User avatar
By Robert E.
#77537 There are many ways to access a url, they are called verbs or methods. They are used for reading data, changing data, deleting data or simply for asking if a url exists. What your browser does is submitting "GET /gpio/0" or "GET /gpio/1" and as the name says your app should handle this as a request which reads. Your app should never change any state following a GET request. That's what a POST or PUT request ist for.
Chrome sends some request to your app actually before you press Return. Either it's looking whether this URL exists or it tries to fetch the favicon in advance. But you can be sure Chrome will never send a POST or a PUT request on its own.

Actually it's very simple to implement it right:
* "GET /gpio" should return the current state
* "POST /gpio" with a new value or simply "POST /gpio/X" should change the current state. you have to redirect to "/gpio" afterwards to make it fail-proof.

And always remember: never ever change data using a request which reads data (GET). Have a look at ... fe_methods

There are no tricks here :-)