HTTP Request action not URL encoding variables

Post your questions and help other users.

Moderator: Martin

Post Reply
PeteD
Posts: 5
Joined: 22 May 2013 20:08

HTTP Request action not URL encoding variables

Post by PeteD » 22 May 2013 20:20

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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: HTTP Request action not URL encoding variables

Post by Martin » 23 May 2013 18:35

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

PeteD
Posts: 5
Joined: 22 May 2013 20:08

Re: HTTP Request action not URL encoding variables

Post by PeteD » 23 May 2013 19:11

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

PeteD
Posts: 5
Joined: 22 May 2013 20:08

Re: HTTP Request action not URL encoding variables

Post by PeteD » 26 Aug 2013 12:57

Hi Martin,

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

Cheers,
Pete

Post Reply