Baseflow / Baseflow/flutter_cached_network_image
Headers are being ignored on Web platform
- Dominant language
- Dart
- Stars
- 2.6k
- Forks
- 731
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 1
Description
## 🐛 Bug Report
Trying to add a token to the request headers but it's not being added
### Expected behavior
Token is added to the request headers
### Reproduction steps
**final headers = {"Authorization": "Bearer #token# "};**
CachedNetworkImage(
width: _width,
height: _height,
imageUrl: imageUrl ?? '',
**httpHeaders: headers,**
placeholder: (context, url) => CircularProgressIndicator(),
errorWidget: (context, url, error) {
print (error.toString());
return Icon(Icons.error);},
imageBuilder: (context, image) => CircleAvatar(
backgroundImage: image,
radius: 150,
),
),
Also tried to use http client with an interceptor http_interceptor: ^1.0.2 but failed as well:
final client = InterceptedClient.build(interceptors: [
CachedImageInterceptor(_token),
]);
cacheManager: CacheManager(
Config( 'cached_images',
fileService: HttpFileService( httpClient: client,
),
),
),
In both cases the header is not added. Looks like headers are ignored or http client is overridden at some point later
### Configuration
**Version:** 3.1.0
**Platform:**
Web
**Flutter Doctor:**
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-x64)
• Flutter version 2.5.1 at ...
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ffb2ecea52 (7 weeks ago), 2021-09-17 15:26:33 -0400
• Engine revision b3af521a05
• Dart version 2.14.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] IntelliJ IDEA Community Edition (version 2021.2.2)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 61.2.4
• Dart plugin version 212.5486
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.