test.dart 413 B

1234567891011121314
  1. import 'dart:convert';
  2. import 'package:dio/dio.dart';
  3. final dio = Dio();
  4. void getHttp() async {
  5. String username = 'user';
  6. String password = 'password';
  7. String basicAuth =
  8. 'Basic ${base64.encode(utf8.encode('$username:$password'))}';
  9. final response = await dio.get('http://localhost:8080/api/v1/projects',options:Options(headers: <String,String>{'authorization': basicAuth}));
  10. print(response);
  11. }