A :send over CapacitorHttp, the plugin that sends the requests of a Capacitor app from native code, where CORS doesn't stop them.
(ns my.app
(:require ["@capacitor/core" :refer [CapacitorHttp]]
[dk.simongray.wary-fetch.capacitor :as capacitor]))
(def send (capacitor/sender CapacitorHttp))
It sends a request as send! does, with the same limits, and gives the same response. It follows the redirects itself, so that :allow-pred takes each URL, and it decodes text by its charset, since the plugin reads all text as UTF-8. The plugin hands a body over whole, so the sender suits feeds and the calls of APIs rather than episodes, which the plugin's docs leave to a plugin for file transfers. Capacitor's HTTP API is at https://capacitorjs.com/docs/apis/http
A :send over CapacitorHttp, the plugin that sends the requests of a
Capacitor app from native code, where CORS doesn't stop them.
(ns my.app
(:require ["@capacitor/core" :refer [CapacitorHttp]]
[dk.simongray.wary-fetch.capacitor :as capacitor]))
(def send (capacitor/sender CapacitorHttp))
It sends a request as send! does, with the same limits, and gives the
same response. It follows the redirects itself, so that :allow-pred
takes each URL, and it decodes text by its charset, since the plugin
reads all text as UTF-8. The plugin hands a body over whole, so the
sender suits feeds and the calls of APIs rather than episodes, which
the plugin's docs leave to a plugin for file transfers. Capacitor's HTTP
API is at https://capacitorjs.com/docs/apis/http(sender http)A function to give as :send, which sends each request with http, the
CapacitorHttp plugin of @capacitor/core, and gives a promise of the
response, as send! does.
The keys of a request are those of send!, and a :sink is a function of the bytes, which it gets in one piece. A failure that the plugin reports is ::http/unreachable, since it says no more of why. The plugin can't stop a request, so the :signal of one is checked before it's sent.
A function to give as :send, which sends each request with `http`, the CapacitorHttp plugin of @capacitor/core, and gives a promise of the response, as send! does. The keys of a request are those of send!, and a :sink is a function of the bytes, which it gets in one piece. A failure that the plugin reports is ::http/unreachable, since it says no more of why. The plugin can't stop a request, so the :signal of one is checked before it's sent.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |