alt_http 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 63

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.

Changelog #

0.2.0 LICENSE updated from original Dart project.

0.1.0 first working version.

example/README.md

Since AltHttpClient inherits from abstract HTTP client just as default one, instead of HttpClient() from dart:io package call AltHttpClient().
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:

with pub:


$ pub get

with Flutter:


$ 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:


import 'package:alt_http/alt_http.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
48
Health:
Code health derived from static analysis. [more]
63
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

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

Platforms

Detected platforms: Flutter, other

Primary library: package:alt_http/alt_http.dart with components: io.

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.

Fix lib/src/http_impl.dart. (-16.51 points)

Analysis of 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.

Fix lib/src/http_headers.dart. (-11.78 points)

Analysis of 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.

Fix lib/src/http_date.dart. (-6.78 points)

Analysis of 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:

  • lib/src/http.dart (5 hints)
  • lib/src/http_parser.dart (5 hints)
  • lib/src/crypto.dart (2 hints)
  • lib/src/http_session.dart (2 hints)
  • lib/alt_http.dart (Run dartfmt to format lib/alt_http.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
Dev dependencies
test ^1.6.8