Open moneer-muntazah opened 1 year ago
It does look like the url string is malformed - it starts with /%7B
.
Note, Dart just forwards to the underlying browser API: https://developer.mozilla.org/en-US/docs/Web/API/fetch
The first argument is passed unmodified to the JS code. It should just be a string - that's not clear in your example. The error is coming from JS.
Thank you so much I got it to work passing data like so
final r = await html.window.fetch(
pdfUrl,
{
'headers': {
'accessToken': accessToken
}
});
Thanks for the update. I'll repurpose this bug as a req to improve documentation.
Hi,
I have a PDF file that I need to download, and it requires an authentication token passed to the header. I've read about the Fetch API https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch and is trying to use it in flutter.
The signature of fetch function in html_dart2js.dart is
Future fetch(/*RequestInfo*/ input, [Map? init])
so I tried to use it like soI no longer get a type exception, but this always throws a FormatException whenever I pass in a url here is an output for trying to fetch a random image
I guess there is an issue with url encoding. Or is my usage wrong?
Thanks