Liking cljdoc? Tell your friends :D

stub-http.core


Responsecljprotocol

recorded-requestsclj

(recorded-requests this)

Return all recorded requests

Return all recorded requests

recorded-responsesclj

(recorded-responses this)

Return all recorded responses

Return all recorded responses

RouteModifiercljprotocol

add-route!clj

(add-route! this request-spec response-spec)

Add a new route by supplied a request and response specification

Add a new route by supplied a request and response specification

routes!clj

(routes! this routes)

Overwrite existing routes with the supplied route map or route function

Overwrite existing routes with the supplied route map or route function

start!clj

(start!)
(start! routes)
(start! settings routes)

Start a new fake web server on a random free port. Usage example:

(with-open [server (start! {"something" {:status 200 :content-type "application/json" :body (json/generate-string {:hello "world"})} {:path "/y" :query-params {:q "something")}} {:status 200 :content-type "application/json" :body (json/generate-string {:hello "brave new world"})}})] ; Do actual HTTP request )

Start a new fake web server on a random free port. Usage example:

(with-open [server (start!
       {"something" {:status 200 :content-type "application/json" :body (json/generate-string {:hello "world"})}
       {:path "/y" :query-params {:q "something")}} {:status 200 :content-type "application/json" :body  (json/generate-string {:hello "brave new world"})}})]
       ; Do actual HTTP request
       )
raw docstring

with-routes!cljmacro

(with-routes! bindings? route-specs & body)

Applies route-specs and creates and stops a fake server implicitly

Applies route-specs and creates and stops a fake server implicitly
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close