title: NoMethodError undefined method `encoding' for nil:NilClass CGI.escape
body: <p>came across this problem a little earlier today, anyone know what might be going on?  I'm a rookie with api's.  Tried Googling but not much luck so far..</p>
  
  <p>Error:</p>
  
  <pre><code>NoMethodError in ArtistsController#index
  undefined method `encoding' for nil:NilClass
  </code></pre>
  
  <p>the problem line is:</p>
  
  <pre><code>response = HTTParty.get("https://api.spotify.com/v1/search?q=#{CGI.escape params[:query]}&amp;type=artist")
  </code></pre>
  
  <p>which makes me think it might be an issue with CGI.escape.</p>
  
  <p>If I enter the following url with a query already at the end everything works fine:
  <code>http://localhost:3000/search?utf8=%E2%9C%93&amp;query=Caribou&amp;commit=Search</code></p>
  
  <p>However, if enter the following url without a query I get the error mentioned above:
  <code>http://localhost:3000/search</code></p>
  
  <p>Guess that explains the nil part, but I don't no how to get past this..</p>
  
  <p>Think that's all the info I need to give for this issue but let me know if more is needed.</p>