Skip to content

Commit 3b98573

Browse files
authored
fix(dart_frog): update Response.json headers to <String, Object> (#331)
1 parent a848a0f commit 3b98573

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/dart_frog/lib/src/response.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Response {
3636
Response.json({
3737
int statusCode = 200,
3838
Object? body = const <String, dynamic>{},
39-
Map<String, String> headers = const <String, String>{},
39+
Map<String, Object> headers = const <String, Object>{},
4040
}) : this(
4141
statusCode: statusCode,
4242
body: body != null ? jsonEncode(body) : null,

packages/dart_frog/test/src/response_test.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ void main() {
2828
test('has correct headers', () {
2929
const headers = <String, String>{'foo': 'bar'};
3030
final response = Response(headers: headers);
31-
expect(response.headers['foo'], equals(headers['foo']));
31+
expect(response.headers['foo'], equals('bar'));
32+
});
33+
34+
test('has correct headers when a key has multiple values', () {
35+
const headers = <String, Object>{
36+
'foo': ['bar', 'baz'],
37+
};
38+
final response = Response(headers: headers);
39+
expect(response.headers['foo'], equals('bar,baz'));
3240
});
3341

3442
group('copyWith', () {

0 commit comments

Comments
 (0)