You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
625 B
Dart
23 lines
625 B
Dart
import 'package:http_interceptor/http_interceptor.dart';
|
|
|
|
class HttpInterceptor extends InterceptorContract {
|
|
Future<RequestData> interceptRequest({RequestData data}) async {
|
|
print('RequestData ${data.body}');
|
|
try {
|
|
// data.params['appid'] = OPEN_WEATHER_API_KEY;
|
|
// data.params['units'] = 'metric';
|
|
data.headers["Content-Type"] = "application/json";
|
|
data.headers["Accept"] = "application/json";
|
|
|
|
} catch (e) {
|
|
print(e);
|
|
}
|
|
return data;
|
|
}
|
|
|
|
@override
|
|
Future<ResponseData> interceptResponse({ResponseData data}) async {
|
|
print('${data.body}');
|
|
return data;
|
|
}
|
|
} |