Close HTTP connections
This commit is contained in:
parent
c4dc934074
commit
ec3ca7d959
|
|
@ -33,10 +33,12 @@ class WebClient {
|
||||||
url += '&per_page=999999';
|
url += '&per_page=999999';
|
||||||
}
|
}
|
||||||
|
|
||||||
final http.Response response = await http.Client().get(
|
final client = http.Client();
|
||||||
|
final http.Response response = await client.get(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: _getHeaders(url, token),
|
headers: _getHeaders(url, token),
|
||||||
);
|
);
|
||||||
|
client.close();
|
||||||
|
|
||||||
if (rawResponse) {
|
if (rawResponse) {
|
||||||
return response;
|
return response;
|
||||||
|
|
@ -78,7 +80,8 @@ class WebClient {
|
||||||
if (multipartFiles != null) {
|
if (multipartFiles != null) {
|
||||||
response = await _uploadFiles(url, token, multipartFiles, data: data);
|
response = await _uploadFiles(url, token, multipartFiles, data: data);
|
||||||
} else {
|
} else {
|
||||||
response = await http.Client()
|
final client = http.Client();
|
||||||
|
response = await client
|
||||||
.post(
|
.post(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
body: data,
|
body: data,
|
||||||
|
|
@ -95,6 +98,7 @@ class WebClient {
|
||||||
seconds: rawResponse ? kMaxRawPostSeconds : kMaxPostSeconds,
|
seconds: rawResponse ? kMaxRawPostSeconds : kMaxPostSeconds,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawResponse) {
|
if (rawResponse) {
|
||||||
|
|
@ -133,7 +137,8 @@ class WebClient {
|
||||||
response = await _uploadFiles(url, token, [multipartFile],
|
response = await _uploadFiles(url, token, [multipartFile],
|
||||||
fileIndex: fileIndex, data: data, method: 'PUT');
|
fileIndex: fileIndex, data: data, method: 'PUT');
|
||||||
} else {
|
} else {
|
||||||
response = await http.Client().put(
|
final client = http.Client();
|
||||||
|
response = await client.put(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
body: data,
|
body: data,
|
||||||
headers: _getHeaders(
|
headers: _getHeaders(
|
||||||
|
|
@ -143,6 +148,7 @@ class WebClient {
|
||||||
idToken: idToken,
|
idToken: idToken,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
_checkResponse(response);
|
_checkResponse(response);
|
||||||
|
|
@ -166,7 +172,8 @@ class WebClient {
|
||||||
|
|
||||||
print('Delete: $url');
|
print('Delete: $url');
|
||||||
|
|
||||||
final http.Response response = await http.Client().delete(
|
final client = http.Client();
|
||||||
|
final http.Response response = await client.delete(
|
||||||
Uri.parse(url),
|
Uri.parse(url),
|
||||||
headers: _getHeaders(
|
headers: _getHeaders(
|
||||||
url,
|
url,
|
||||||
|
|
@ -175,6 +182,7 @@ class WebClient {
|
||||||
idToken: idToken,
|
idToken: idToken,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
client.close();
|
||||||
|
|
||||||
_checkResponse(response);
|
_checkResponse(response);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,9 @@ Future<Response> _loadPDF(
|
||||||
} else {
|
} else {
|
||||||
final invitation = invoice.invitations.first;
|
final invitation = invoice.invitations.first;
|
||||||
final url = invitation.downloadLink;
|
final url = invitation.downloadLink;
|
||||||
response = await http.Client().get(Uri.parse(url));
|
final client = http.Client();
|
||||||
|
response = await client.get(Uri.parse(url));
|
||||||
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.statusCode >= 400) {
|
if (response.statusCode >= 400) {
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ BEGIN
|
||||||
BLOCK "040904e4"
|
BLOCK "040904e4"
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Invoice Ninja" "\0"
|
VALUE "CompanyName", "Invoice Ninja" "\0"
|
||||||
VALUE "FileDescription", "Invoice Clients, Track Work-Time, Get Paid Online." "\0"
|
VALUE "FileDescription", "Invoice Ninja" "\0"
|
||||||
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
VALUE "FileVersion", VERSION_AS_STRING "\0"
|
||||||
VALUE "InternalName", "invoiceninja" "\0"
|
VALUE "InternalName", "invoiceninja" "\0"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2021 Invoice Ninja. All rights reserved." "\0"
|
VALUE "LegalCopyright", "Copyright (C) 2021 Invoice Ninja. All rights reserved." "\0"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue