Skip to content

Commit

Permalink
[network] definitely fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed May 25, 2024
1 parent 3691e8b commit 7b692ce
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/utils/dio.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:dio/dio.dart';
import 'package:sit/utils/strings.dart';

Options disableRedirectFormEncodedOptions({
Map<String, dynamic>? headers,
Expand Down Expand Up @@ -29,7 +30,8 @@ Future<Response> processRedirect(
if (location.isEmpty) return response;
final locationUri = Uri.parse(location);
if (!locationUri.isAbsolute) {
location = '${response.requestOptions.uri.origin}/$location';
// to prevent double-slash issue
location = '${response.requestOptions.uri.origin.removeSuffix("/")}/${location.removePrefix("/")}';
}
final redirectedResponse = await dio.get(
location,
Expand Down

0 comments on commit 7b692ce

Please sign in to comment.