Http get action: What is script to test http result code?

Using latest version of FB7

HTTP GET call to a server.

I am fine with any http result code 2xx or 3xx. If it is 4xx or 5xx that is a failure.... 2xx and 3xx are success.

What is the script to make this evaluation?

(Currently, the action returns 302 and the action fails...)

Hi Sam

[code]if (Action.ResponseCode == 304) {ActionResult = true;Continue = true;}[/code]

Unfortunately there’s a bug with this in the current release build which means the ResponseCode doesn’t get set.

This build includes the fix for it :

http://downloads.finalbuilder.com/downloads/finalbuilder/700/FB700_2224.exe

Thank you!

What does the script look like to allow result codes 2?? and 3?? to be success/continue, and anything else to be a fail?

(and that example is js syntax, right?)


Thanks!

Yes it’s javascript. The action by default fails if the exit code is >= 400, so the code you need just to treat 300 codes as success:

[code] if (Action.ResponseCode <= 400) {ActionResult = true;Continue = true;}[/code]

One touch up.

You wrote:

>> The action by default fails if the exit code is >= 400, so the code you need just to treat 300 codes as success: 

This is not what I observe. I observe that when the http get returns 302, the action fails. (is this because of the bug in the current release build of FB7?)

Will have to check… I just haven’t been able to find a url that gives me the 300 codes to test with. It looks like the library we use is throwing exceptions (which we catch) when it gets anything other than a 200. I will have to test this some more. You can control how the action behaves with code as a work around for now (assuming you installed the bugfix build).