This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-05
Channels
- # aws (1)
- # beginners (57)
- # boot (3)
- # cider (6)
- # clara (49)
- # cljs-dev (47)
- # cljsjs (23)
- # clojure (144)
- # clojure-dev (2)
- # clojure-finland (1)
- # clojure-germany (1)
- # clojure-sg (1)
- # clojure-spec (25)
- # clojure-uk (245)
- # clojurescript (39)
- # core-async (3)
- # cursive (6)
- # datomic (117)
- # emacs (3)
- # fulcro (6)
- # hoplon (10)
- # jobs (7)
- # juxt (5)
- # leiningen (11)
- # om (27)
- # pedestal (4)
- # perun (2)
- # re-frame (22)
- # reagent (35)
- # ring-swagger (11)
- # shadow-cljs (333)
- # spacemacs (10)
- # specter (10)
- # sql (20)
- # vim (8)
Is there a middleware to help with controlling rates of calls per endpoint or user? For example users can call only 20 request per second, and customize by endpoint, etc….
I’m trying to use compojure-api 2.0.0-alpha7 and I’m having troubles with adding a JSON encoder for a specific class
If i return something that contains a java.time.LocalDate
, I get this exception:
clojure.lang.ExceptionInfo: Malformed application/json in :muuntaja/encode
Caused by: com.fasterxml.jackson.core.JsonGenerationException: Cannot JSON encode object of class: class java.lang.Class: class java.time.LocalDate
adding a Cheshire JSON encoder this way doesn’t help:
(cheshire.generate/add-encoder LocalDate (fn [^LocalDate date ^JsonGenerator gen]
(.writeString gen (.toString date))))
@arttuka Muuntaja uses Cheshire as-is, so should work.
(require '[muuntaja.core :as muuntaja])
;; with defaults
(def m (muuntaja/create))
(cheshire.generate/add-encoder ...)
(->> {:date (t/today)}
(muuntaja/encode m "application/json")
slurp)