title: Invoke-Webrequest host variable, Invalid URI: The hostname could not be parsed
body: <p>I'm trying to do an api call to a webservice and not sure what goes wrong.
  Could be the quotation that is wrong in the <code>$request</code> variable.</p>
  
  <pre><code>[string]$subKey = "AAAAA-BBBBB-FFFFFF-EEEEEE-DDDDD"
  [string]$method = "GET"
  [string]$searchParam = "Type"
  [string]$searchQuery = "QQ"
  $request=("""https://api.test.com/api/assets/search?" + $searchParam + "=" + $searchQuery + "&amp;PageSize=10&amp;Page=1"""+" -Headers @{""Authorization"""+"="""+"SubKey "+$subKey+"""}")
  
  Invoke-WebRequest $request -Method Get
  </code></pre>
  
  <p>This results in: </p>
  
  <blockquote>
    <p>Invalid URI: The hostname could not be parsed.</p>
  </blockquote>
  
  <p>If I just copy the output of <code>$request</code> and run <code>Invoke-WebRequest</code> it works.</p>