alt_http 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

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.


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:

  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';
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]
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.13.1+4

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. (-61.03 points)

Analysis of lib/src/http_impl.dart reported 188 hints, including:

line 35 col 29: Unnecessary new keyword.

line 43 col 15: Unnecessary new keyword.

line 83 col 21: Unnecessary new keyword.

line 90 col 18: Unnecessary new keyword.

line 97 col 12: Unnecessary new keyword.

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

Analysis of lib/src/http_headers.dart reported 64 hints, including:

line 23 col 32: Use = to separate a named parameter from its default value.

line 25 col 20: Unnecessary new keyword.

line 48 col 13: Unnecessary new keyword.

line 89 col 11: Use isEmpty instead of length

line 107 col 56: Unnecessary new keyword.

Fix lib/src/http_parser.dart. (-20.99 points)

Analysis of lib/src/http_parser.dart reported 47 hints, including:

line 10 col 23: Avoid const keyword.

line 12 col 27: Avoid const keyword.

line 14 col 25: Avoid const keyword.

line 16 col 25: Avoid const keyword.

line 21 col 32: Avoid const keyword.

Fix additional 5 files with analysis or formatting issues. (-32.97 points)

Additional issues in the following files:

  • lib/src/http_date.dart (35 hints)
  • lib/src/crypto.dart (21 hints)
  • lib/src/http_session.dart (9 hints)
  • lib/src/http.dart (5 hints)
  • lib/alt_http.dart (Run dartfmt to format lib/alt_http.dart.)


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