refactor: avoid string conversion for comparison
This commit is contained in:
parent
9de57fad9b
commit
4069f0a02f
|
|
@ -163,25 +163,25 @@ class MatrixApi {
|
||||||
http.Response resp;
|
http.Response resp;
|
||||||
var jsonResp = <String, dynamic>{};
|
var jsonResp = <String, dynamic>{};
|
||||||
try {
|
try {
|
||||||
switch (describeEnum(type)) {
|
switch (type) {
|
||||||
case 'GET':
|
case RequestType.GET:
|
||||||
resp = await httpClient.get(url, headers: headers).timeout(
|
resp = await httpClient.get(url, headers: headers).timeout(
|
||||||
Duration(seconds: timeout),
|
Duration(seconds: timeout),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'POST':
|
case RequestType.POST:
|
||||||
resp =
|
resp =
|
||||||
await httpClient.post(url, body: json, headers: headers).timeout(
|
await httpClient.post(url, body: json, headers: headers).timeout(
|
||||||
Duration(seconds: timeout),
|
Duration(seconds: timeout),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'PUT':
|
case RequestType.PUT:
|
||||||
resp =
|
resp =
|
||||||
await httpClient.put(url, body: json, headers: headers).timeout(
|
await httpClient.put(url, body: json, headers: headers).timeout(
|
||||||
Duration(seconds: timeout),
|
Duration(seconds: timeout),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'DELETE':
|
case RequestType.DELETE:
|
||||||
resp = await httpClient.delete(url, headers: headers).timeout(
|
resp = await httpClient.delete(url, headers: headers).timeout(
|
||||||
Duration(seconds: timeout),
|
Duration(seconds: timeout),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue