Created
January 9, 2013 17:05
-
-
Save owainlewis/4494844 to your computer and use it in GitHub Desktop.
Testing Compojure applications in the REPL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defroutes app | |
(GET "/" [] "<h1>Index route</h1>") | |
(route/not-found "<h1>Page not found</h1>")) | |
(defn fake-request [routes uri method & params] | |
(let [localhost "127.0.0.1"] | |
(routes {:server-port 80 | |
:server-name localhost | |
:remote-addr localhost | |
:uri uri | |
:scheme :http | |
:headers (or params {}) | |
:request-method method}))) | |
;; YOU CAN TEST ROUTES IN THE REPL | |
(def index-page (fake-request app "/" :get)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment