http
http copied to clipboard
Unable to retrieve local file
Bug description
I'm trying to use my local file (inside assets folder) as a service mock, but I can't retrieve any data from it.
iOS
During the test on the iOS device, I'm unable to catch any error
Android
During the test on the Android device I facing off two types of errors:
- without
file://I getMalformedURLException; - adding
file://to my current URL I get aCastExpection
Steps to reproduce
- Add a
JSONfile inside your assets; - Make a
Getwith the package pointing on the file, in my case:
return from(Http.get({ url: `file://assets/demo/getProfile.json` })).pipe(
map(response => response.data),
);
Expected behavior
From both platforms, I expect to get value from my JSON (as HttpService from `Angular. On the iOS side, I even expect to catch some errors.
Tested on
iOS
- Device: iPhone 12
- OS: 15.3
Android
- Device: A52s
- OS: Android 11