title: AngularJS $http GET comma separated query string parameters
body: <p>I'm trying to do a HTTP GET call using Angular's $http. I've written a generic function like this,</p>
  
  <pre><code>function doGETRequest(url, params) {
        return $http({
          method: 'GET',
          url: baseURL + url,
          headers: {
            'Authorization': 'Bearer ' + access_token
          },
          params: params
        });
      }
  </code></pre>
  
  <p>I want to create a URL like this,
  <code>https://content.googleapis.com/drive/v2/about?fields=quotaBytesTotal%2CquotaBytesUsed%2CrootFolderId%2Cuser</code> but I cannot for the life of me figure out the query param part. So far I tried the following:</p>
  
  <pre><code> doGETRequest('/about', {fields:'user,quotaBytesTotal,quotaBytesUsed,rootFolderId'})
  
  
  doGETRequest('/about', {fields:['user','quotaBytesTotal','quotaBytesUsed','rootFolderId']})
  
  
  doGETRequest('/about', {fields:encodeURIComponent('user,quotaBytesTotal,quotaBytesUsed,rootFolderId')})
  </code></pre>
  
  <p>It does work for the second one, but it parses it as <code>https://content.googleapis.com/drive/v2/about?fields=user&amp;fields=quotaBytesTotal&amp;fields=quotaBytesUsed&amp;fields=rootFolderId</code> and Google just sends response for the first query and ignores the rest (as expected). </p>
  
  <p>So the question is how do I pass comma separated values in query params? Do I have to manually write URL encoded values? Doesn't this beat the purpose of having a params field?</p>