Skip to content

Instantly share code, notes, and snippets.

@temochka
Last active June 1, 2017 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save temochka/d2d9539da752ac8094bb28ba1ccb3a55 to your computer and use it in GitHub Desktop.
Save temochka/d2d9539da752ac8094bb28ba1ccb3a55 to your computer and use it in GitHub Desktop.
(ns cursive-test)
(defn $render-digest
[{{{accept "accept"} :headers} :request
{:keys [date-range]} ::request
record ::entry}]
(let [digest (apply db/get-digest-data record date-range)]
(if (re-matches #"^application/json;?.*" accept)
(json/generate-string digest)
(ring-response {:headers {"Cache-Control" "max-age=0, private, no-cache, no-store, must-revalidate"
"Content-Type" "text/html;charset=utf-8"}
:body (apply str (digest-template record digest))}))))
(ns cursive-test)
(defn $render-digest
[{{{accept "accept"} :headers} :request}
{:keys [date-range]} ::request
record ::entry]
(let [digest (apply db/get-digest-data record date-range)]
(if (re-matches #"^application/json;?.*" accept)
(json/generate-string digest)
(ring-response {:headers {"Cache-Control" "max-age=0, private, no-cache, no-store, must-revalidate"
"Content-Type" "text/html;charset=utf-8"}
:body (apply str (digest-template record digest))}))))
diff --git a/src/dmarc/cursive-test.clj b/src/dmarc/cursive-test.clj
index 041a172..3780c6c 100644
--- a/src/dmarc/cursive-test.clj
+++ b/src/dmarc/cursive-test.clj
@@ -1,9 +1,9 @@
(ns cursive-test)
(defn $render-digest
- [{{{accept "accept"} :headers} :request
+ [{{{accept "accept"} :headers} :request}
{:keys [date-range]} ::request
- record ::entry}]
+ record ::entry]
(let [digest (apply db/get-digest-data record date-range)]
(if (re-matches #"^application/json;?.*" accept)
(json/generate-string digest)
@temochka
Copy link
Author

temochka commented Jun 1, 2017

IDEA information

IntelliJ IDEA 2017.1.2
Build #IC-171.4249.39, built on April 25, 2017
JRE: 1.8.0_112-release-736-b16 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.5

Cursive information

Version: 1.5.0-2017.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment