title: GCDWebserver listening for HTTP POSTs
body: <p>I need my Swift 2.1 app to listen for HTTP POSTs arriving on my public endpoint by another service. Not sure how to initialise GCDWebserver.</p>
  
  <pre><code>let webServer = GCDWebServer()
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>webServer.addHandlerForMethod("POST", path: "https://myendpoint.com",
      requestClass: GCDWebServerRequest.self, asyncProcessBlock: { request in
      print("WebServer - POST detected")
  })
  webServer.startWithPort(80, bonjourName: "Web Server")
  </code></pre>
  
  <p>and</p>
  
  <pre><code>try! webServer.startWithOptions([GCDWebServerOption_BonjourName: "", GCDWebServerOption_BonjourType: "https://myendpoint.com", GCDWebServerOption_Port : 80, GCDWebServerOption_AutomaticallySuspendInBackground: false])
  </code></pre>
  
  <p>and</p>
  
  <pre><code>webServer.addHandlerForMethod("POST", path:"https://myendpoint.com", requestClass: GCDWebServerURLEncodedFormRequest.self, asyncProcessBlock: {request in
      print("WebServer: POST captured")
  })
  webServer.start()
  </code></pre>
  
  <p>but I am not getting anywhere.</p>
  
  <p>Whatever I try, URL property points to my localhost and publicURL is always nil.</p>
  
  <p>Any tips?</p>