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))
The sender sends a request as send! does, with the same limits, and returns the same response. It follows redirects itself, so that :allow-pred checks each URL. It decodes text by its charset, since the plugin decodes all text as UTF-8. The plugin hands over a body whole, so the sender suits feeds and API calls 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))
The sender sends a request as send! does, with the same limits, and
returns the same response. It follows redirects itself, so that
:allow-pred checks each URL. It decodes text by its charset, since the
plugin decodes all text as UTF-8. The plugin hands over a body whole, so
the sender suits feeds and API calls 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 pass as :send, which sends each request with http (the
CapacitorHttp plugin of @capacitor/core) and returns a promise of the
response, as send! does.
The keys of a request are those of send!. A :sink is a function of the bytes, which it gets in one piece. A body without a Content-Type is sent as text/plain or application/octet-stream, since the plugin on iOS drops a body without one. A failure that the plugin reports is ::http/unreachable, since the plugin doesn't say why it failed. The plugin can't stop a request, so the sender checks its :signal only before sending it.
A function to pass as :send, which sends each request with `http` (the CapacitorHttp plugin of @capacitor/core) and returns a promise of the response, as send! does. The keys of a request are those of send!. A :sink is a function of the bytes, which it gets in one piece. A body without a Content-Type is sent as text/plain or application/octet-stream, since the plugin on iOS drops a body without one. A failure that the plugin reports is ::http/unreachable, since the plugin doesn't say why it failed. The plugin can't stop a request, so the sender checks its :signal only before sending it.
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 |