Route Arguments Not Working
I am running into an issue when trying to use Route Arguments. I defined the web route as:
@WebRoute(GET, '/Key/<key_val>/Data/')
but when a GET request such as:
GET /Key/DATA_UPLOAD_METHOD/Data/LoRa
is sent the program does not recognize it as a valid route. and I get:
MWS2-DEBUG> From 192.168.4.2:51137 GET /Key/DATA_UPLOAD_METHOD/Data/LoRa >> [307] Temporary Redirect
Your route ends with Data/ in the declaration, but with Data/LoRa in your request.
Try to change the webroute to @webroute(GET, '/Key/<key_val>/Data/LoRa')
or to @webroute(GET, '/Key/<key_val>/Data/<page_name>')
or change your request.
I must of miss copied but my route is:
@WebRoute(GET, '/Key/<key_val>/Data/<data>')
It does not recognize it with the request:
GET /Key/DATA_UPLOAD_METHOD/Data/LoRa
Ah ok. Check if this change fix it for you: in file "webRoute.py" on line 57
regex += '/([\\w.]*)'
else :
regex += '/' + part
remove the [ and ] like so:
regex += '/(\\w.*)'
else :
regex += '/' + part
It seems, there is a bug in lib re (RegEx) on micropython(ESP32, others not tested). Maybe somebody knows more, but this is the dirty fix, that works for me right now.
This fixed for me. Thanks