title: Encode URL before using in Alamofire
body: <p>Right now I am making an Alamofire request with parameters. I need the final URL before the request is made because I need to hash the final URL and add it to the request header. This is how I was doing it but it does not give me the final URL to hash and put into a header. </p>
  
  <pre><code>Alamofire.request(url, method: .get, parameters: parameters, encoding: URLEncoding.default, headers: headers).responseJSON
  </code></pre>
  
  <p>I want to get the encoded URL before I make this request so the request looks like this </p>
  
  <pre><code>Alamofire.request(url, method: .get, headers: headers).responseJSON
  </code></pre>
  
  <p>Right now as a work around, I am creating the URL manually by appending each parameter manually. Is there a better way to do it?</p>
  
  <pre><code>let rexUrl = "https://www.google.com"
  let requestPath = "/accounts"
  let url = rexUrl + requestPath + "?apikey=\(apiKey)&amp;market=USD&amp;quantity=\(amount)&amp;rate=\(price)&amp;nonce=\(Date().timeIntervalSince1970)"
  </code></pre>