title: Can't set URLRequest Authorization Header
body: <p>Since swift 3 update I change my requests from NSMutableURLRequest to URLRequest. After that all my requests stopped worked due invalid credentials problem. Already tried and search everything. My service continue same as before and tested my requests from a request simulator and went fine.</p>
  
  <pre><code>let url : NSString = "http://url.service.com/method?param=\(name)" as NSString
  
  var request = URLRequest(url: URL(string: url.addingPercentEscapes(using: String.Encoding.utf8.rawValue)!)!)
  request.httpMethod = "POST"
  request.setAuthorizationHeader()
  
  URLSession.shared.dataTask(with: request) {data, response, err in
  
      do {
  
          //something
  
      } catch let error1 as NSError {
          //something
      }
  
  }.resume()
  </code></pre>
  
  <p>My setAuthorizationHeader() extension</p>
  
  <pre><code>extension URLRequest {
  
      mutating func setAuthorizationHeader(){
  
          let data = "user:password".data(using: String.Encoding.utf8)
  
          let base64 = data?.base64EncodedString(options: [])
          setValue("Basic \(base64)", forHTTPHeaderField: "Authorization")
      }
  }
  </code></pre>