mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
fix http
This commit is contained in:
@@ -218,14 +218,14 @@ class RHttpAdapter implements HttpClientAdapter {
|
|||||||
rhttp.ClientSettings settings;
|
rhttp.ClientSettings settings;
|
||||||
|
|
||||||
RHttpAdapter(this.settings) {
|
RHttpAdapter(this.settings) {
|
||||||
settings.copyWith(
|
settings = settings.copyWith(
|
||||||
redirectSettings: const rhttp.RedirectSettings.limited(5),
|
redirectSettings: const rhttp.RedirectSettings.limited(5),
|
||||||
timeoutSettings: const rhttp.TimeoutSettings(
|
timeoutSettings: const rhttp.TimeoutSettings(
|
||||||
connectTimeout: Duration(seconds: 15),
|
connectTimeout: Duration(seconds: 15),
|
||||||
keepAliveTimeout: Duration(seconds: 60),
|
keepAliveTimeout: Duration(seconds: 60),
|
||||||
keepAlivePing: Duration(seconds: 30),
|
keepAlivePing: Duration(seconds: 30),
|
||||||
),
|
),
|
||||||
httpVersionPref: rhttp.HttpVersionPref.http1_1,
|
throwOnStatusCode: false,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,12 +275,7 @@ class RHttpAdapter implements HttpClientAdapter {
|
|||||||
var data = res.body;
|
var data = res.body;
|
||||||
if(headers['content-encoding']?.contains('gzip') ?? false) {
|
if(headers['content-encoding']?.contains('gzip') ?? false) {
|
||||||
// rhttp does not support gzip decoding
|
// rhttp does not support gzip decoding
|
||||||
var buffer = <int>[];
|
data = gzip.decoder.bind(data).map((data) => Uint8List.fromList(data));
|
||||||
await for (var chunk in data) {
|
|
||||||
buffer.addAll(chunk);
|
|
||||||
}
|
|
||||||
data = Stream.value(Uint8List.fromList(gzip.decode(buffer)));
|
|
||||||
buffer.clear();
|
|
||||||
}
|
}
|
||||||
return ResponseBody(
|
return ResponseBody(
|
||||||
data,
|
data,
|
||||||
|
Reference in New Issue
Block a user