node_http 1.0.0

node_http #

HTTP client using Node I/O system for Dart.

Usage #

A simple usage example:

import 'package:node_http/node_http.dart' as http;

main() async {
  // For one-off requests.
  final response1 = await http.get(''); 
  // To re-use socket connections:
  final client = new http.NodeClient();
  final response2 = await client.get('');

Configuration and build #

Add build_node_compilers and build_runner to dev_dependencies section in pubspec.yaml of your project:

  build_runner: # needed to run the build

Add build.yaml file to the root of your project:

      - "node/**"
      - "test/**" # Include this if you want to compile tests.
      - "example/**" # Include this if you want to compile examples.

By convention all Dart files which declare main function go in node/ folder.

To build your project run following:

pub run build_runner build --output=build/

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.0 #

  • Upgraded dependency on http package to ^0.12.0.

1.0.0-dev.10.0 #

  • Added httpOptions and httpsOptions arguments to NodeClient constructor to allow full customization of Node.js HTTP agents used by the client.
  • Exposed HttpAgentOptions and HttpsAgentOptions from node_interop package.
  • Deprecated NodeClient.keepAlive and NodeClient.keepAliveMsecs getters. To be removed in 1.0.0.

1.0.0-dev.9.0 #

  • Upgraded to build_node_compilers 0.2.0

1.0.0-dev.8.0 #

  • Fixed analysis warnings with latest Pub and Dart SDK.

1.0.0-dev.7.0 #

  • Added support for followRedirects.

1.0.0-dev.6.0 #

  • Upgraded to latest build_node_compilers.

1.0.0-dev.5.0 #

  • Fixed deprecation warnings with Dart 2 dev 61 SDK version.

1.0.0-dev.4.0 #

  • Breaking: node_http now exports only a subset of classes from http package.
  • Fixed: library-level functions aliased to those from http package which use Dart IOClient.

1.0.0-dev.3.0 #

  • Fixed: decoding set-cookie header of HTTP response (#18)

1.0.0-dev.2.0 #

  • Fixed: strong mode issue in converting JS response headers into a Dart Map.

1.0.0-dev.1.0 #

  • Split from package:node_interop/http.dart.


import 'package:node_http/node_http.dart' as http;

main() async {
  // For one-off requests.
  final response = await http.get('');
  // To re-use socket connections:
  final client = new http.NodeClient();
  final response2 = await client.get('');
  client.close(); // make sure to close the client when work is done.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  node_http: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:node_http/node_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 Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/src/node_client.dart. (-6.31 points)

Analysis of lib/src/node_client.dart reported 13 hints, including:

line 65 col 21: Unnecessary new keyword.

line 82 col 42: Unnecessary new keyword.

line 99 col 17: Unnecessary new keyword.

line 116 col 19: Unnecessary new keyword.

line 125 col 21: Unnecessary new keyword.

Fix lib/node_http.dart. (-0.50 points)

Analysis of lib/node_http.dart reported 1 hint:

line 110 col 16: Unnecessary new keyword.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

The package description is too short. (-18 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
http ^0.12.0 0.12.0+4
node_interop ^1.0.0-dev.13.0 1.0.3
node_io ^1.0.0-dev 1.0.1+2
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.12
http_parser 3.1.3
js 0.6.1+1
meta 1.1.8
path 1.6.4
pedantic 1.9.0
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_node_compilers ^0.2.0
build_runner ^1.0.0
build_test any
test ^1.0.0