Hi,
I'm trying to use asynchronous mode (ring-1.6.0-beta6) for server sent events and GET requests work fine. POST requests hang, however, and I don't know where to start looking what the problem is. I can reproduce the issue with this code:
(defproject ring-async-test "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/core.async "0.2.395"]
[ring/ring "1.6.0-beta6"]
[compojure "1.6.0-beta1"]
[cheshire "5.6.3"]]
:main ring-async-test.core)
(ns ring-async-test.core
(:require [ring.adapter.jetty :as jetty]
[ring.util.response :as response]
[compojure.core :refer :all]
[compojure.route :as route]))
(defn not-found []
(fn [request respond raise]
(respond (-> (response/response "Not found")
(response/status 404)))))
(defroutes app-routes
(GET "/" [] "he")
(not-found))
(defn app []
(-> app-routes))
(defonce server (atom nil))
(defn start-server []
(when @server
(.stop @server))
(reset! server (jetty/run-jetty (app)
{:port 3803
:join? false
:async? true})))
Any POST request I send to this server just hangs:
* Trying ::1...
* Connected to localhost (::1) port 3803 (#0)
> POST /x HTTP/1.1
> Host: localhost:3803
> User-Agent: curl/7.49.1
> Accept: */*
> Content-Length: 2
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 2 out of 2 bytes
^C
Is there something wrong with my code, or are POST requests not supported in async mode yet?
Thanks!
Hans