Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the connectionInfo getter #1163

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkgs/http_profile/lib/src/http_client_request_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,11 @@ final class HttpClientRequestProfile {
}

Map<String, dynamic /*String|int*/ >? get connectionInfo =>
requestData._data['connectionInfo'] == null
requestData._requestData['connectionInfo'] == null
? null
: UnmodifiableMapView(
requestData._data['connectionInfo'] as Map<String, dynamic>,
requestData._requestData['connectionInfo']
as Map<String, dynamic>,
);

/// Details about the request.
Expand Down
3 changes: 0 additions & 3 deletions pkgs/http_profile/lib/src/http_profile_response_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ final class HttpProfileResponseData {
List<int> get bodyBytes =>
UnmodifiableListView(_data['responseBodyBytes'] as List<int>);

Map<String, dynamic /*String|int*/ >? get connectionInfo =>
_responseData['connectionInfo'] as Map<String, dynamic>?;

/// The response headers where duplicate headers are represented using a list
/// of values.
///
Expand Down
8 changes: 4 additions & 4 deletions pkgs/http_profile/test/http_client_request_profile_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void main() {
final responseData = backingMap['responseData'] as Map<String, dynamic>;
expect(requestData['connectionInfo'], isNull);
expect(responseData['connectionInfo'], isNull);
expect(profile.responseData.connectionInfo, isNull);
expect(profile.connectionInfo, isNull);

profile.connectionInfo = {
'localPort': 1285,
Expand All @@ -102,7 +102,7 @@ void main() {
expect(connectionInfoFromRequestData['connectionPoolId'], '21x23');
expect(connectionInfoFromResponseData['connectionPoolId'], '21x23');

final connectionInfoFromGetter = profile.responseData.connectionInfo!;
final connectionInfoFromGetter = profile.connectionInfo!;
expect(connectionInfoFromGetter['localPort'], 1285);
expect(connectionInfoFromGetter['remotePort'], 443);
expect(connectionInfoFromGetter['connectionPoolId'], '21x23');
Expand All @@ -128,7 +128,7 @@ void main() {
expect(connectionInfoFromRequestData['connectionPoolId'], '21x23');
expect(connectionInfoFromResponseData['connectionPoolId'], '21x23');

final connectionInfoFromGetter = profile.responseData.connectionInfo!;
final connectionInfoFromGetter = profile.connectionInfo!;
expect(connectionInfoFromGetter['localPort'], 1285);
expect(connectionInfoFromGetter['remotePort'], 443);
expect(connectionInfoFromGetter['connectionPoolId'], '21x23');
Expand All @@ -137,6 +137,6 @@ void main() {

expect(requestData['connectionInfo'], isNull);
expect(responseData['connectionInfo'], isNull);
expect(profile.responseData.connectionInfo, isNull);
expect(profile.connectionInfo, isNull);
});
}