John S. was doing some work on the search feature of a client's website when he noticed that he would receive a 500 Server Error if he tested against the API with an empty string.

This struck John as being pretty strange since not only had the search feature had been in place for years, but also, he could go to the search page, click on the "Search" button without entering anything and receive an "Item Not Found" response.

Curious, John poked around the underlying web code behind the search page and found that a previous developer had been aware of the error and had implemented a quite precocious workaround.

<cfif Trim(url.searchText) EQ "">
      <!--- empty string will cause an error --->
      <cfset searchString="supercalifragilisticexpialidocious">

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!