Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Dec 20, 2023
1 parent 20e969b commit 57e91e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
6 changes: 1 addition & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
## 4.1.0

- Add "headers" option to add additional response headers.
For example: --headers="header1=value;header2=value;"

- Update minimum Dart SDK to `3.0.0`.
## 4.0.2-wip

For example: `--headers="header1=value;header2=value;"`
- Update minimum Dart SDK to `3.0.0`.

## 4.0.1
Expand Down
13 changes: 6 additions & 7 deletions bin/dhttpd.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ Future<void> main(List<String> args) async {
print('Server started on port ${options.port}');
}

Map<String, String> _parseKeyValuePairs(String str) {
final regex = RegExp(r'([\w-]+)=([\w-]+)(;|$)');
final map = <String, String>{};
return <String, String>{
for (var match in regex.allMatches(str)) match.group(1)!: match.group(2)!,
};
}
Map<String, String> _parseKeyValuePairs(String str) => <String, String>{
for (var match in _regex.allMatches(str))
match.group(1)!: match.group(2)!,
};

final _regex = RegExp(r'([\w-]+)=([\w-]+)(;|$)');
3 changes: 1 addition & 2 deletions lib/dhttpd.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ Middleware _headersMiddleware(Map<String, String>? headers) =>
responseHeaders[entry.key] = entry.value;
}
}
final newResponse = response.change(headers: responseHeaders);
return newResponse;
return response.change(headers: responseHeaders);
};

0 comments on commit 57e91e9

Please sign in to comment.