WorkerGlobalScope.fetch doesn't serialize TypedArrays properly #48938
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
library-html
web-libraries
Issues impacting dart:html, etc., libraries
I was attempting to implement a fetch based transport for the grpc-dart package as opposed to xhr due to the following issue:
grpc/grpc-dart#511
My initial implementation was calling WorkerGlobalScope.fetch, but I could never get the body right. I have a Uint8List that I wanted in the body which should just map to a javascript Uint8Array, but instead it would convert it to just a comma separated string of ints. I suspect it has to do with
convertDartToNative_Dictionary
which fetch calls internally.https://github.com/jbrownsw/grpc-dart/blob/26b5dbb8dbbaccea04bca7cc866a4035a1b503d3/lib/src/client/transport/fetch_transport.dart
My workaround was just to define the interop init type here and instead of calling wgs.fetch I use callMethod:
jbrownsw/grpc-dart@e627db5
A minimal(ish) sample would be something like the following:
I'm then using chrome dev tools to monitor the network traffic and I'm expecting to see a 70 byte message being sent. However, instead I see a content-length 222 message because it converts data to a comma separated list of ints (essentially just toString()).
The text was updated successfully, but these errors were encountered: