Browser REPL server hang when receive unknown POST
When running tests, those tests may fire off a HTTP request. In general, these shouldn't go to the ClojureScript REPL server but accidents happen and/or the user doesn't care about the HTTP request succeeding (fire & forget). However, this can cause an issue with the REPL hanging due to the network request never returning. This is due to the fact that the server as set up by the browser REPL is not able to handle: A) Non-EDN input, B) A null type dispatch, when something submitted happens to be valid EDN by accident
Run ClojureScript Browser REPL in one terminal:
Run cURL in another terminal:
cURL will never terminate. It will wait for response from Cljs. Cljs terminal will print the following to STDOUT:
I’ve uploaded 3 patches that shows various different approaches.
Of these, I think -3 should be used, as it will ensure that in all cases of failure (these and others we don’t know about) the socket is closed & 500 is sent.