Page 1 of 1

HTTP Request action not URL encoding variables

Posted: 22 May 2013 20:20
by PeteD
Hi,

Just getting into this really cool tool, but have found what I believe to be a bug.

I created a simple flow to forward any received SMS to Prowl using an HTTP request action. While testing I was only using the word "test" (no quotes) but when I sent a text more than one word in, e.g. "This is a test", the flow errors.

Examining the log reveals an exception: IllegalArgumentException: Illegal character in query at index 153.

Position 153 equates to the first space character.

It would seem that the {sms_text} variable is not being URL encoded before being replaced in the URL string for the HTTP request. I would think that this would happen with any variable.

For the moment I can achieve what I need to via an email action, but this issue needs to be addressed.

Thanks,
Pete

Re: HTTP Request action not URL encoding variables

Posted: 23 May 2013 18:35
by Martin
Hi,

A variable is not automatically URL encoded since the content of the variable might be already in the encoded form. I will add a function for URL encoding variables in the next version, then you can specify whether you want the variable to be encoded or not (this will probably look like {encodeURL(variable)}). A very limited encoding of spaces only can be done with an inline script {replace(variable, " ", "%20")}.

Regards,
Martin

Re: HTTP Request action not URL encoding variables

Posted: 23 May 2013 19:11
by PeteD
Hi Martin,

Thanks for taking the time to reply.

An inbuilt function to do the encoding would be awesome!

In the meantime, I'll probably just stick with using Prowl via email, but I would prefer to use an HTTP Request.

Cheers,
Pete

Re: HTTP Request action not URL encoding variables

Posted: 26 Aug 2013 12:57
by PeteD
Hi Martin,

Just wanted to say thanks for adding the encodeUrl function. It's working brilliantly for me.

Cheers,
Pete