                          (parser 'buffer-string)
                          (type "POST")
                          (params nil)
-                         (sync nil))
+                         (sync nil)
+                         (timeout request-timeout))
   "Send an asynchronous HTTP request to the ycmd server.
 
 This starts the server if necessary.

         (port (process-contact p :service)))
    (when p (delete-process p))
    (unless port
      (error "Could not retrive unused localhost port"))
    port))

(defun ycmd--exit-code-as-string (code)

         (response-fn (lambda (response)
                        (let ((data (request-response-data response)))
                          (ycmd--log-content "HTTP RESPONSE CONTENT" data)
                          data)))
         (request-args (list :type type :params params :data content
                             :parser parser :headers headers
                             :timeout timeout)))
    (ycmd--log-content "HTTP REQUEST CONTENT" content)

    (if sync
        (let* (result
               (cb (cl-function
                    (lambda (&key response &allow-other-keys)
                      (setq result (funcall response-fn response))))))
          (with-local-quit
            (apply #'request url :sync t :complete cb request-args))
          result)
      (deferred:$
        (apply #'request-deferred url request-args)
        (deferred:nextc it response-fn)))))

(provide 'ycmd)

