Skip to content

Instantly share code, notes, and snippets.

@tie-rack
Last active December 15, 2015 22:19
Show Gist options
  • Save tie-rack/5332168 to your computer and use it in GitHub Desktop.
Save tie-rack/5332168 to your computer and use it in GitHub Desktop.
(defn example-middleware [handler]
(fn [request]
(let [now (System/currentTimeMillis)
modified-request (assoc-in request [:headers "received-at"] now)
response (handler modified-request)]
(assoc-in response
[:headers "processing-time"]
(- (System/currentTimeMillis) now)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment