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

Route Arguments Not Working #38

Open
jvigliottaa opened this issue Apr 28, 2020 · 4 comments · May be fixed by #67
Open

Route Arguments Not Working #38

jvigliottaa opened this issue Apr 28, 2020 · 4 comments · May be fixed by #67

Comments

@jvigliottaa
Copy link

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

@YveIce
Copy link

YveIce commented May 5, 2020

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.

@jvigliottaa
Copy link
Author

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

@YveIce
Copy link

YveIce commented May 6, 2020

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.

@zeeshanyshaikh
Copy link

This fixed for me. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants