You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 26, 2022. It is now read-only.
Is your feature request related to a problem? Please describe.
The full scope of HTTP is not presently supported by this plugin. The plugin naively assumes all responses are either JSON or some other UTF8 encoded string. This removes the possibility of interacting with APIs that return data with Content-Type application/octet-stream`.
Describe the solution you'd like
I would like the type of the data field of the response to depend on the Content-Type. Specifically, if the Content-Type is application/json it should be of type {} or []. If the Content-Type is application/octet-stream it should return either a Blob or an ArrayBuffer.
This will require some unfortunately wasteful changes along the native bridge since as far as I understand, the capacitor<->native bridge only supports a data type that is isomorphic to JSON. This problem can be solved by either a Hex or Base64 expansion across the capacitor barrier which is then re-compacted into the desired type before leaving the TypeScript side of the plugin to the calling code.
Describe alternatives you've considered
As far as alternatives go, I think there are only 2 real considerations here. 1. Blob vs ArrayBuffer as a TypeScript exit type. 2. Base16 (alignment) vs Base64 (space efficiency) as a utf8 string encoding over the capacitor<->native bridge.
The text was updated successfully, but these errors were encountered:
Thanks, yea that hasn't been implemented yet. You are correct about the serialization today, but we're thinking about ways we can somewhat natively support ArrayBuffer for the bridge (such as streaming it over an HTTP connection), but that will have to happen in core first. For now we would just do base64 most likely which isn't ideal but will at least add support for it.
Is there any idea around timeline for this feature? Or perhaps, are there any plans to create ArrayBuffer in the bridge? I can see major performance improvements for many plugins and interactions with the native code if this is implemented.
Is your feature request related to a problem? Please describe.
The full scope of HTTP is not presently supported by this plugin. The plugin naively assumes all responses are either JSON or some other UTF8 encoded string. This removes the possibility of interacting with APIs that return data with
Content-Type
application/octet-stream`.Describe the solution you'd like
I would like the type of the
data
field of the response to depend on theContent-Type
. Specifically, if theContent-Type
isapplication/json
it should be of type{}
or[]
. If theContent-Type
isapplication/octet-stream
it should return either aBlob
or anArrayBuffer
.This will require some unfortunately wasteful changes along the native bridge since as far as I understand, the capacitor<->native bridge only supports a data type that is isomorphic to JSON. This problem can be solved by either a Hex or Base64 expansion across the capacitor barrier which is then re-compacted into the desired type before leaving the TypeScript side of the plugin to the calling code.
Describe alternatives you've considered
As far as alternatives go, I think there are only 2 real considerations here. 1.
Blob
vsArrayBuffer
as a TypeScript exit type. 2. Base16 (alignment) vs Base64 (space efficiency) as a utf8 string encoding over the capacitor<->native bridge.The text was updated successfully, but these errors were encountered: