Alt HTTP #
If you don't absolutely need it, DON'T USE THIS PACKAGE.
This package is simply snapshot of the part of default Dart HTTP Client taken from the current master with patch TO ALLOW CASE SENSITIVE REQUEST HEADERS.
Default client forces all headers to lowercase which can create problems with some servers (IE. you can't perform basic authorization because server expects 'Authorization' header, not 'authorization'. You can read more about it HERE and HERE. If you possible can (not everyone can), try to contact server owner to fix server behavior.
If everything else fails, and you have no other options you can use this package as a simple replacement for default HTTP client. It inherits from abstract HTTP client just as default one, just instead of
HttpClient() from dart:io package call
AltHttpClient(). It's been tested and working with Dio. You can find example HERE.
Since it's taken from current master snapshot it requires Dart 2.5 and Flutter 1.8+, due to breaking changes in HttpClient package. This package should add about 250 kb to your app when compiled. I've copied only neccessary parts, everything else is called from default dart:io namespace (IE. websockets).
I have no intention of updating and maintaining this package unless I personally need it.
0.2.0 LICENSE updated from original Dart project.
0.1.0 first working version.
Since AltHttpClient inherits from abstract HTTP client just as default one, instead of
HttpClient() from dart:io package call
It's been tested and working with Dio. You can find example HERE.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: alt_http: ^0.2.0
2. Install it
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Oct 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.5.1
- pana: 0.12.21
Detected platforms: Flutter, other
Health issues and suggestions
Document public APIs. (-1 points)
4 out of 4 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.
lib/src/http_impl.dart. (-16.51 points)
lib/src/http_impl.dart reported 36 hints, including:
line 284 col 16: Property getter recursively returns itself.
line 719 col 3: Avoid return types on setters.
line 785 col 3: Avoid return types on setters.
line 790 col 3: Avoid return types on setters.
line 795 col 3: Avoid return types on setters.
lib/src/http_headers.dart. (-11.78 points)
lib/src/http_headers.dart reported 25 hints, including:
line 23 col 32: Use
= to separate a named parameter from its default value.
line 89 col 11: Use isEmpty instead of length
line 113 col 3: Avoid return types on setters.
line 139 col 3: Avoid return types on setters.
line 163 col 3: Avoid return types on setters.
lib/src/http_date.dart. (-6.78 points)
lib/src/http_date.dart reported 14 hints, including:
line 7 col 1: Prefer using /// for doc comments.
line 35 col 3: Prefer using /// for doc comments.
line 77 col 3: Prefer using /// for doc comments.
line 117 col 16: The value of the local variable 'wkdaysLowerCase' isn't used.
line 126 col 16: The value of the local variable 'weekdaysLowerCase' isn't used.
Fix additional 5 files with analysis or formatting issues. (-6.96 points)
Additional issues in the following files:
|Dart SDK||>=2.5.0 <3.0.0|