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

**URL:** <https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129>\
**Category:** Discussion\
**Created:** [April 23, 2013, 4:26am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129 "2013-04-23T04:26:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafael](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.finalbuilder.com/forums/u/rafael)\
**Post date:** [April 23, 2013, 4:26am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129/1 "2013-04-23T04:26:41Z")

</div>

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...)

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [April 23, 2013, 6:17am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129/2 "2013-04-23T06:17:00Z")

</div>

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](http://downloads.finalbuilder.com/downloads/finalbuilder/700/FB700_2224.exe)

---

<div class="post-metadata">

**Author:** ![rafael](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.finalbuilder.com/forums/u/rafael)\
**Post date:** [April 23, 2013, 7:17am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129/3 "2013-04-23T07:17:50Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [April 23, 2013, 7:20am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129/4 "2013-04-23T07:20:46Z")

</div>

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]

---

<div class="post-metadata">

**Author:** ![rafael](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/4da419/32.png) [@rafael](https://www.finalbuilder.com/forums/u/rafael)\
**Post date:** [April 23, 2013, 7:25am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129/5 "2013-04-23T07:25:51Z")

</div>

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:&nbsp;

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?)

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [April 23, 2013, 7:42am UTC](https://www.finalbuilder.com/forums/t/http-get-action-what-is-script-to-test-http-result-code/2129/6 "2013-04-23T07:42:39Z")

</div>

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).
