| @@ -9,7 +9,7 @@ |
| 9 | ["dart:convert" :as conv] | 9 | ["dart:convert" :as conv] |
| 10 | [frq.upload.core :as core])) | 10 | [frq.upload.core :as core])) |
| 11 | | 11 | |
| 12 | -(defonce ^:private client (io/HttpClient)) | 12 | +(defonce ^:private ^io/HttpClient client (io/HttpClient)) |
| 13 | | 13 | |
| 14 | (defn ^:async upload! | 14 | (defn ^:async upload! |
| 15 | "Upload the file at `path` as `did`'s, answering the URL freeq serves it back | 15 | "Upload the file at `path` as `did`'s, answering the URL freeq serves it back |
| @@ -20,7 +20,7 @@ |
| 20 | {p :path ct :content-type body :body} (core/request did channel filename | 20 | {p :path ct :content-type body :body} (core/request did channel filename |
| 21 | (vec bytes)) | 21 | (vec bytes)) |
| 22 | uri (Uri.https host p) | 22 | uri (Uri.https host p) |
| 23 | - req (await (.postUrl client uri))] | 23 | + ^io/HttpClientRequest req (await (.postUrl client uri))] |
| 24 | (.set (.-headers req) "user-agent" "frq") | 24 | (.set (.-headers req) "user-agent" "frq") |
| 25 | (.set (.-headers req) "accept" "application/json") | 25 | (.set (.-headers req) "accept" "application/json") |
| 26 | (.set (.-headers req) "content-type" ct) | 26 | (.set (.-headers req) "content-type" ct) |
| @@ -33,7 +33,7 @@ |
| 33 | (let [out (io/BytesBuilder)] | 33 | (let [out (io/BytesBuilder)] |
| 34 | (doseq [b body] (.addByte out b)) | 34 | (doseq [b body] (.addByte out b)) |
| 35 | (.add req (.takeBytes out))) | 35 | (.add req (.takeBytes out))) |
| 36 | - (let [resp (await (.close req)) | 36 | + (let [^io/HttpClientResponse resp (await (.close req)) |
| 37 | payload (await (.join (.transform resp (.-decoder conv/utf8)))) | 37 | payload (await (.join (.transform resp (.-decoder conv/utf8)))) |
| 38 | status (.-statusCode resp)] | 38 | status (.-statusCode resp)] |
| 39 | (if (and (>= status 200) (< status 300)) | 39 | (if (and (>= status 200) (< status 300)) |