Skip to content

Commit

Permalink
feat: method to get the Uri host (e.g. for ping)
Browse files Browse the repository at this point in the history
Impacted file:
* `uri_helper.dart`: new `getUriHost` method
  • Loading branch information
monsieurtanuki committed Sep 7, 2023
1 parent a26ec2a commit f441164
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/src/utils/uri_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ class UriHelper {
}) =>
Uri(
scheme: OpenFoodAPIConfiguration.uriScheme,
host: OpenFoodAPIConfiguration.getQueryType(queryType) == QueryType.PROD
? OpenFoodAPIConfiguration.uriProdHost
: OpenFoodAPIConfiguration.uriTestHost,
host: getUriHost(queryType),
path: path,
queryParameters: addUserAgentParameters
? HttpHelper.addUserAgentParameters(queryParameters)
: queryParameters,
userInfo: userInfo,
);

static String getUriHost(final QueryType? queryType) =>
OpenFoodAPIConfiguration.getQueryType(queryType) == QueryType.PROD
? OpenFoodAPIConfiguration.uriProdHost
: OpenFoodAPIConfiguration.uriTestHost;

static Uri getPostUri({
required final String path,
final QueryType? queryType,
Expand Down

0 comments on commit f441164

Please sign in to comment.