And you may have just found some interesting thing, may be an issue in the .parse(...).
I did some deep digging in the example, because it fooled me nicely...
Below my 'console talkative', working code. The main changes and detections are:
I made the method in the form submit a upper-case post... that solves the problem of asking the request req variable for the method before gong after the parsed request, which is called r. (Side note: I find it odd - to say the least - that lower-case url is a global that comes into play without definition... @Gordon?). But making that change still did not work, so I wanted to know and added all this console outputs, also did some renaming: upd - Url ParseD - for r... and - when 'consoling' that .parse(... return object, I got 'consoled' by the detection of the issue that, even though the request says it is a POST, the parsed url or request or what it is claims the request.POST as a GET. - See console output after the code...
I run it on a Espruino-WiFi... so some lines got commented and a few got added to take care of that...
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
...Ic
And you may have just found some interesting thing, may be an issue in the
.parse(...)
.I did some deep digging in the example, because it fooled me nicely...
Below my 'console talkative', working code. The main changes and detections are:
I made the method in the form submit a upper-case post... that solves the problem of asking the request
req
variable for themethod
before gong after theparsed request
, which is calledr
. (Side note: I find it odd - to say the least - that lower-caseurl
is a global that comes into play without definition... @Gordon?). But making that change still did not work, so I wanted to know and added all this console outputs, also did some renaming:upd
- Url ParseD - for r... and - when 'consoling' that.parse(...
return object, I got 'consoled' by the detection of the issue that, even though the request says it is a POST, the parsed url or request or what it is claims the request.POST as a GET. - See console output after the code...I run it on a Espruino-WiFi... so some lines got commented and a few got added to take care of that...
In the next post is the 'chatty' console output, that shows that...