14 lines
356 B
Dart
14 lines
356 B
Dart
|
import 'package:http/http.dart' as http;
|
||
|
|
||
|
class UserAgentClient extends http.BaseClient {
|
||
|
final String userAgent;
|
||
|
final http.Client _inner;
|
||
|
|
||
|
UserAgentClient(this.userAgent, this._inner);
|
||
|
|
||
|
@override
|
||
|
Future<http.StreamedResponse> send(http.BaseRequest request) {
|
||
|
request.headers['user-agent'] = userAgent;
|
||
|
return _inner.send(request);
|
||
|
}
|
||
|
}
|