title: Swift http error -1004
body: <p>I am getting error while making POST request with swift 4(iOS)
  I am getting following debug description:</p>
  
  <pre><code>2017-11-09 23:12:57.283421+0300 ios1[35428:5830006] 
  Task &lt;23DDE1DF-B58F-4A9E-9BB1-21571EE25661&gt;.&lt;1&gt; HTTP load failed (error code: -1004 [1:61])
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>let dict = ["link": web.text, "addr": edit.text]
  
  guard let uploadData = try? JSONEncoder().encode(dict) else { return }
  
  let actInd = showActivityIndicatory(uiView: appView)
  
  let url = URL(string: host)!
  
  var request = URLRequest(url: url)
  request.httpMethod = "POST"
  request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  
  let task = URLSession.shared.uploadTask(with: request, from: uploadData) { data, response, error in
  
      if error != nil {
          // handle the transport error
          result = 2
          print(error.debugDescription)
          return
      }
  
      guard let response = response as? HTTPURLResponse, response.statusCode == 201 else {
          result = 1
          return
      }
  
      if response.mimeType == "text/plain" || response.mimeType == "text/plain", let data = data {
          result = 0
          print(data)
      }
  }
  
  task.resume()
  </code></pre>
  
  <p><strong>P.S.</strong>: I could see that request has been done correctly on server.</p>
  
  <p>Thank you a lot</p>