Skip to content

Commit

Permalink
fix(dynamite_runtime): removing empty query parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <[email protected]>
  • Loading branch information
Leptopoda committed Dec 16, 2023
1 parent 181ebae commit e73a27e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/dynamite/dynamite_runtime/lib/src/dynamite_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,11 @@ class DynamiteClient {
this.cookieJar,
this.authentications = const [],
}) : httpClient = (httpClient ?? HttpClient())..userAgent = userAgent,
baseURL = baseURL.normalizeEmptyPath();
baseURL = baseURL.normalizeEmptyPath() {
if (baseURL.queryParametersAll.isNotEmpty) {
throw UnsupportedError('Dynamite can not work with a baseURL containing query parameters.');
}
}

/// The base server url used to build the request uri.
///
Expand Down Expand Up @@ -416,14 +420,8 @@ class DynamiteClient {
final Uint8List? body,
final Set<int>? validStatuses,
) {
final queryParameters = {
...baseURL.queryParametersAll,
...path.queryParametersAll,
};
final uri = baseURL.replace(
path: '${baseURL.path}${path.path}',
queryParameters: queryParameters.isNotEmpty ? queryParameters : null,
);
final uri = Uri.parse('$baseURL$path');

return executeRawRequest(
method,
uri,
Expand Down

0 comments on commit e73a27e

Please sign in to comment.