Fork me on GitHub

what do you all use to send e-mail from your application?


I used postal years ago but it seems to no longer be developed


If it still works, does it need to be changed? (I do not know if it still works)


um. i think it works actually


If the underlying language and libraries it relies upon value backwards compatibility, and the things it interoperates with, then changes are needed less often.


sweeps typos under rug

David Omar06:09:10

What is the idiomatic way to reject a function call if parameters do not meet the expectations? Let's say a function only works in non-empty lists, and I call that function with an empty list.

David Omar06:09:15

Does it need to be specified with spec?

Jakub Holý (HolyJak)20:09:57

No, you can use preconditions like {:pre [(some-predicate? my-arg1)...]}

Lennart Buit06:09:00

you can spec it with fdef, e.g. by saying that its input should be a (s/coll-of something? :min-count 1)


Good Morning everybody. I decied to do a webapp from ground up. But the documentation... it is so fragmented, everybody is using different libraries, a lot of things are deprecated etc... Can somebody help me here? I would love to use sse-consumer as SSE which updates my HTML generated by HICCUP (function (html-layout/driver-monitoring-country "Driver Monitoring" country-selection)) renders HTML. I know that there is async abstraction in http-kit but it looks different than "native" async that i would like to use as I already implemented one part in it. So if i can stay with ring + compojure + async it would be great. This is my async block - when I get driver-status, something is saved to the database and sse-consumer writes out message.

(defn sse-consumer
  "Accept messages and persist them to a database."
  (fn [req res raise]
  (let [in (chan (sliding-buffer 64))]
    (go-loop [data (<! in)]
      (when data
          (println (format "sse-consumer received message %s" data))
          (recur (<! in)))))

(defn database-consumer
  "Accept messages and persist them to a database."
  (let [in (chan (sliding-buffer 64))]
    (go-loop [data (<! in)]
      (when data
          (recur (<! in)))))

(defn producer
  "Produce messages and deliver them to consumers."
  [& channels]
    (doseq [msg (get-driver-status)
            out channels]
      (<! (timeout 300000))
      (>! out msg))))

(xbim.driver-data/producer (xbim.driver-data/database-consumer) (xbim.driver-data/sse-consumer)) 
These are my routers
(defroutes route-map
           (GET "/driver-monitoring" {cookies :cookies}
             (html-layout/driver-monitoring-general "Driver Monitoring" cookies))
           (GET "/driver-monitoring/custom" [country-selection]
             (do (println country-selection)
             (html-layout/driver-monitoring-country "Driver Monitoring" country-selection)))
           (route/not-found "<h3>Route Not defined!</h3>"))  
These are my wrappers
(def app
  (-> route-map
      (wrap-resource "public")
Thank you very much.

Akiz07:09:42 This tutorials leads just to...

Fri Sep 20 08:59:01 CEST 2019 [worker-3] ERROR - GET /async
clojure.lang.ArityException: Wrong number of args (1) passed to: xbim.core/fn--18358/fn--18359
	at clojure.lang.AFn.throwArity(


@UBRV1HXPD I’m running into the same issue, did you ever figure out how to do this?

Lennart Buit06:09:06

you can spec it with fdef, e.g. by saying that its input should be a (s/coll-of something? :min-count 1)

Lennart Buit06:09:30

(uh did I send doubly? flaky internet)

David Omar07:09:22

hahaha, yes. But thank you. I'll check that out.

David Omar08:09:39

Hi again. I just finished writing the spec for one function my-function inside namespace. I also created a test-my-namespace.clj inside test. Then, I was able to call (stest/check my-function)`, and I got this output:

;; => ({:spec #<clojure.spec.alpha$fspec_impl$reify__2451@5cdab40c>,
;;      :sym namespace.line/my-function,
;;      :clojure.spec.test.check/ret {:num-tests 1000, :pass? true, :result true, :seed 1568968371375, :time-elapsed-ms 5851}})

David Omar08:09:30

But now I'd like to know how to set those generated tests, so they run when I run lein test from the terminal.

David Omar08:09:17

In the same way a test defined with deftest would have run.

David Omar08:09:27

I've read the guide on spec and haven't found it yet. In the guide, it lists the different ways to build the generators. And the third one says >Use test.check or other test.check compatible libraries (like test.chuck)

David Omar08:09:23

I don't know if that's what I'm looking for. Specially since it's the least preferred.

David Omar09:09:59

Wow. Just checked the first one. Very creative. I think I'll stick with that one. Thanks!


im having a really hard time getting a CORS middleware to return 200 on options requests, and was hoping someone might help walk me through it


Hi! I'm having a problem doing a redirection with Ring. If I'm on a page with the POST method, doing the redirection will keep it. How can I force all my redirections to be GET? Thank you in advance.


Thank you!


I just tested it and it doesn't work. Crashes directly into anti-forgery token


does anyone have any idea why this wont pass cors? i have been at this for hours and hours and hours this shouldnt be this hard!


@pweyand What's with the preflight stuff in that code? You should just be able to use wrap-cors but it needs to be the outermost layer of middleware, e.g.,

(-> handler
    (wrap-cors ,,, various CORS options here))


Here's what we have at work:

(-> handler
    ,,, other middleware ,,,
                               :access-control-allow-headers #{"accept"
                               :access-control-allow-methods [:delete :get
                                                              :patch :post :put]
                               ;; 24 hours (in seconds) -- note that only Firefox
                               ;; will honor this; other browsers cap lower!
                               :access-control-max-age "86400"
                               :access-control-allow-origin #".*"))


wrap-cors handles the preflight check internally.