aREST icon indicating copy to clipboard operation
aREST copied to clipboard

Bug with Variable and Function Names

Open dgunnell opened this issue 8 years ago • 5 comments

If you create a function say fan and also create a variable called fanstate then whenever a client rest request is made to read value of fanstate, process() routine will find it but later on in processing of the request it also find partial match of function name and things client is trying to invoke function resulting in an error. Using answer.startsWith() in process state machine is not going to work in this case or the state machine itself will need to be tightened up to handle this situation.

Example that causes problem: rest.variable("fanstate", &fanstate); rest.function("fan", fanControl);

dgunnell avatar May 30 '17 19:05 dgunnell

Indeed, that's a bug, well catched :)

marcoschwartz avatar Jun 02 '17 17:06 marcoschwartz

I was pulling my hair out LOL!

Dave

On Fri, Jun 2, 2017 at 1:28 PM, marcoschwartz [email protected] wrote:

Indeed, that's a bug, well catched :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marcoschwartz/aREST/issues/153#issuecomment-305858341, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFni6yfsWEmmBZfJzysU6wGdmytM7rJks5sAEYmgaJpZM4Nqv5Q .

dgunnell avatar Jun 02 '17 17:06 dgunnell

Noticed something else:

example:

http://192.168.1.25/controlfan?param=ON

When I am evaluating in code for param the first character is stripped so I only see 'N'

I have to do this

http://192.168.1.25/controlfan?param=_ON

I think I can probably use any character for the first one but is that the correct behavior?

Dave

On Fri, Jun 2, 2017 at 1:51 PM, David Gunnell [email protected] wrote:

I was pulling my hair out LOL!

Dave

On Fri, Jun 2, 2017 at 1:28 PM, marcoschwartz [email protected] wrote:

Indeed, that's a bug, well catched :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marcoschwartz/aREST/issues/153#issuecomment-305858341, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFni6yfsWEmmBZfJzysU6wGdmytM7rJks5sAEYmgaJpZM4Nqv5Q .

dgunnell avatar Jun 04 '17 14:06 dgunnell

For the second issue, it's because you need to use params= (with an s) :)

marcoschwartz avatar Jun 06 '17 14:06 marcoschwartz

Thanks!

Dave

On Tue, Jun 6, 2017 at 10:58 AM, marcoschwartz [email protected] wrote:

For the second issue, it's because you need to use params= (with an s) :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marcoschwartz/aREST/issues/153#issuecomment-306513173, or mute the thread https://github.com/notifications/unsubscribe-auth/ABFni__oBZPnqbEzjnZjhoDAti6iY2Jgks5sBWkOgaJpZM4Nqv5Q .

dgunnell avatar Jun 06 '17 16:06 dgunnell