Liking cljdoc? Tell your friends :D

hara.net.http


deleteclj

(delete url)
(delete url opts)

getclj

(get url)
(get url opts)

handlerclj

(handler x)

constructs handler from

((handler [[:get "/hello" (constantly "hello")] [:post "/hello" (constantly "hello post")]]) {:method :post :route "/hello"}) => "hello"

constructs handler from

((handler [[:get  "/hello" (constantly "hello")]
           [:post "/hello" (constantly "hello post")]])
 {:method :post
  :route "/hello"})
=> "hello"
raw docstring

(head url)
(head url opts)

htmlclj

(html rep)

converts either node or tree representation to a html string

(html [:body [:div "hello"] "world"]) => "<body>\n <div>hello</div>world\n</body>"

converts either node or tree representation to a html string

(html [:body [:div "hello"] "world"])
=> "<body>\n    <div>hello</div>world\n</body>"
raw docstring

mock-endpointclj

(mock-endpoint handler route)
(mock-endpoint handler route {:keys [format] :or {format :edn}})

creates a mock-endpoint for testing

((mock-endpoint (fn [req] {:status 200 :body (str {:status :return :data req})}) "/endpoint") {:id :add :args [1 2 3]}) => {:method :post, :route "/endpoint", :body "{:id :add, :args [1 2 3]}"}

creates a mock-endpoint for testing

((mock-endpoint (fn [req] {:status 200
                           :body (str {:status :return
                                       :data req})}) "/endpoint")
 {:id   :add
  :args [1 2 3]})
=> {:method :post, :route "/endpoint", :body "{:id :add, :args [1 2 3]}"}
raw docstring

patchclj

(patch url)
(patch url opts)

postclj

(post url)
(post url opts)

putclj

(put url)
(put url opts)

remoteclj

(remote url {:keys [id args format] :as opts :or {format :edn}})

creates a remote access to an endpoint

creates a remote access to an endpoint
raw docstring

requestclj

(request req)
(request uri
         {:keys [client as raw type callback error method]
          :as opts
          :or {type :sync as :string method :get client +default-client+}})

performs a http request

(request "http://www.yahoo.com") => (contains {:status number? :body string? :version "HTTP_1_1" :headers map?})

performs a http request

(request "http://www.yahoo.com")
=> (contains {:status number?
              :body string?
              :version "HTTP_1_1"
              :headers map?})
raw docstring

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

× close