File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/parenthesin/helpers/state_flow/server Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 1616 metosin/reitit-pedestal {:mvn/version " 0.7.2" }
1717 metosin/reitit-swagger {:mvn/version " 0.7.2" }
1818 metosin/reitit-swagger-ui {:mvn/version " 0.7.2" }
19+ ring/ring-codec {:mvn/version " 1.2.0" }
1920 migratus/migratus {:mvn/version " 1.6.3" }
2021 org.slf4j/slf4j-simple {:mvn/version " 2.0.17" }
2122 prismatic/schema {:mvn/version " 1.4.1" }}
Original file line number Diff line number Diff line change 22 (:require [cheshire.core :as json]
33 [clojure.string :as string]
44 [io.pedestal.test :as pt]
5+ [ring.util.codec :as codec]
56 [state-flow.api :as state-flow.api]
67 [state-flow.core :as state-flow :refer [flow]]))
78
89(defn- do-request [service-fn verb route body headers]
910 (let [headers-with-default (merge {" Content-Type" " application/json" } headers)
10- encoded-body (json/encode body)]
11+ content-type (get headers-with-default " Content-Type" )
12+ encoded-body (case content-type
13+ " application/json" (json/encode body)
14+ " application/x-www-form-urlencoded" (codec/form-encode body)
15+ body)]
1116 (pt/response-for service-fn verb route :headers headers-with-default :body encoded-body)))
1217
1318(defn- parsed-response
1722 request))
1823
1924(defn request!
25+ " Flow that make http request using `:io.pedestal.http/service-fn`, not a fully
26+ featured http client, currently only supports content type `application/json`
27+ and `application/x-www-form-urlencoded`."
2028 [{:keys [method uri body headers]}]
2129 (flow " makes http request"
2230 [service-fn (state-flow.api/get-state (comp :io.pedestal.http/service-fn :webserver :webserver ))]
You can’t perform that action at this time.
0 commit comments