https://github.com/f3ath/dart-http-interop-http
Interop-compatible wrapper over the standard Dart http package
https://github.com/f3ath/dart-http-interop-http
Last synced: 5 months ago
JSON representation
Interop-compatible wrapper over the standard Dart http package
- Host: GitHub
- URL: https://github.com/f3ath/dart-http-interop-http
- Owner: f3ath
- License: mit
- Created: 2023-04-17T03:18:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-30T22:00:10.000Z (over 1 year ago)
- Last Synced: 2025-01-09T03:04:02.219Z (about 1 year ago)
- Language: Dart
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# http_interop_http
[Interop]-compatible wrapper over the standard Dart http package.
```dart
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:http_interop/extensions.dart';
import 'package:http_interop/http_interop.dart';
import 'package:http_interop_http/http_interop_http.dart';
Future main() async {
final client = http.Client();
final request = Request(
'get',
Uri.parse('https://example.com'),
Body(),
Headers.from({
'User-Agent': ['R2-D2']
}));
final response = await client.handleInterop(request);
client.close(); // Don't forget to close the client.
print(response.statusCode);
print(response.headers);
print(await response.body.decode(utf8));
}
```
[Interop]: https://pub.dev/packages/http_interop