http_extensions_base_url 0.1.2

Dart native js
Flutter Android iOS web

An http extension that adds base url to requests with a relative path.

example/example.dart

import 'package:http_extensions/http_extensions.dart';
import 'package:http_extensions_base_url/http_extensions_base_url.dart';
import 'package:logging/logging.dart';
import 'package:http/http.dart';

main() async {
  // Displaying logs
  Logger.root.level = Level.ALL;
  Logger.root.onRecord.listen((record) {
    print('${record.level.name}: ${record.time}: ${record.message}');
  });

  final client = ExtendedClient(
    inner: Client(),
    extensions: [
      BaseUrlExtension(
          logger: Logger("BaseUrl"),
          defaultOptions: BaseUrlOptions(url: Uri.parse("http://flutter.dev"))),
    ],
  );

  final response = await client.get("/docs");
  print("Html content: ${response.body}");
}
0
likes
90
pub points
57%
popularity

An http extension that adds base url to requests with a relative path.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

alois.deniel@gmail.com

License

MIT (LICENSE)

Dependencies

http, http_extensions, logging, meta

More

Packages that depend on http_extensions_base_url