diff --git a/pkgs/cupertino_http/CHANGELOG.md b/pkgs/cupertino_http/CHANGELOG.md index 03f1f46cf4..85a04f1569 100644 --- a/pkgs/cupertino_http/CHANGELOG.md +++ b/pkgs/cupertino_http/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.1 + +* Add a `URLSession.sessionDescription` field. + ## 0.1.0 * Restructure `package:cupertino_http` to offer a single `import`. diff --git a/pkgs/cupertino_http/example/integration_test/url_session_test.dart b/pkgs/cupertino_http/example/integration_test/url_session_test.dart index 70505238b6..3bed931e95 100644 --- a/pkgs/cupertino_http/example/integration_test/url_session_test.dart +++ b/pkgs/cupertino_http/example/integration_test/url_session_test.dart @@ -185,6 +185,13 @@ void testURLSession(URLSession session) { server.close(); }); + test('sessionDescription', () async { + session.sessionDescription = null; + expect(session.sessionDescription, null); + session.sessionDescription = 'Happy Days!'; + expect(session.sessionDescription, 'Happy Days!'); + }); + test('dataTask', () async { final task = session.dataTaskWithRequest( URLRequest.fromUrl(Uri.parse('http://localhost:${server.port}'))) diff --git a/pkgs/cupertino_http/lib/src/cupertino_api.dart b/pkgs/cupertino_http/lib/src/cupertino_api.dart index e70b93ba82..1c6125d012 100644 --- a/pkgs/cupertino_http/lib/src/cupertino_api.dart +++ b/pkgs/cupertino_http/lib/src/cupertino_api.dart @@ -1067,15 +1067,24 @@ class URLSession extends _ObjectHolder { onFinishedDownloading: onFinishedDownloading, onComplete: onComplete); } - // A **copy** of the configuration for this sesion. - // - // See [NSURLSession.configuration](https://developer.apple.com/documentation/foundation/nsurlsession/1411477-configuration) + + /// A **copy** of the configuration for this sesion. + /// + /// See [NSURLSession.configuration](https://developer.apple.com/documentation/foundation/nsurlsession/1411477-configuration) URLSessionConfiguration get configuration => URLSessionConfiguration._( ncb.NSURLSessionConfiguration.castFrom(_nsObject.configuration!)); - // Create a [URLSessionTask] that accesses a server URL. - // - // See [NSURLSession dataTaskWithRequest:](https://developer.apple.com/documentation/foundation/nsurlsession/1410592-datataskwithrequest) + /// A description of the session that may be useful for debugging. + /// + /// See [NSURLSession.sessionDescription](https://developer.apple.com/documentation/foundation/nsurlsession/1408277-sessiondescription) + String? get sessionDescription => + toStringOrNull(_nsObject.sessionDescription); + set sessionDescription(String? value) => + _nsObject.sessionDescription = value?.toNSString(linkedLibs); + + /// Create a [URLSessionTask] that accesses a server URL. + /// + /// See [NSURLSession dataTaskWithRequest:](https://developer.apple.com/documentation/foundation/nsurlsession/1410592-datataskwithrequest) URLSessionTask dataTaskWithRequest(URLRequest request) { final task = URLSessionTask._(_nsObject.dataTaskWithRequest_(request._nsObject)); diff --git a/pkgs/cupertino_http/pubspec.yaml b/pkgs/cupertino_http/pubspec.yaml index a0f85dc41b..8f241a74a0 100644 --- a/pkgs/cupertino_http/pubspec.yaml +++ b/pkgs/cupertino_http/pubspec.yaml @@ -2,7 +2,7 @@ name: cupertino_http description: > A macOS/iOS Flutter plugin that provides access to the Foundation URL Loading System. -version: 0.1.0 +version: 0.1.1 repository: https://github.com/dart-lang/http/tree/master/pkgs/cupertino_http environment: