On FW/1, do I need to return after doing a redirect?

615 views Asked by At

I have a function in a controller that looks something like this

void function edit(required struct rc) output="false"   {

   ...

   if (...) {

      ArrayAppend(rc.message, "<b>Error:</b> Something did not work right.");

      variables.fw.redirect(".home", "all");
      return;  // ?
      } 

   }

Do I need to return or does the redirect imply returning?

1

There are 1 answers

0
Brad Wood On BEST ANSWER

If you look at the redirect method in the FW/1 source, you'll see it just does a regular cflocation. That means, page execution will not proceed past that line of code so the return should be unnecessary.

https://github.com/framework-one/fw1/blob/develop/framework/one.cfc#L1031

Code Snippet

 ...
 location( targetURL, false, statusCode );
 ...