Skip to content

Commit

Permalink
Use split instead of indexOf
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed Sep 4, 2024
1 parent a4e9985 commit 8fdf551
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions web/lib/src/helpers/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ extension XMLHttpRequestGlue on XMLHttpRequest {
final headersList =
LineSplitter.split(headersString).where((header) => header.isNotEmpty);
for (final header in headersList) {
final splitIdx = header.indexOf(': ');
if (splitIdx == -1) {
final split = header.split(': ');
if (split.length <= 1) {
continue;
}
final key = header.substring(0, splitIdx).toLowerCase();
final value = header.substring(splitIdx + 2);
final key = split[0].toLowerCase();
final value = split.skip(1).join(': ');
headers.update(
key,
(oldValue) => '$oldValue, $value',
Expand Down

0 comments on commit 8fdf551

Please sign in to comment.