@@ -41,8 +41,11 @@ void main() {
4141 });
4242 successServerUri = Uri .http ('localhost:${successServer .port }' );
4343 final client = CupertinoClientWithProfile .defaultSessionConfiguration ();
44- await client.post (successServerUri,
45- headers: {'Content-Type' : 'text/plain' }, body: 'Hi' );
44+ await client.post (
45+ successServerUri,
46+ headers: {'Content-Type' : 'text/plain' },
47+ body: 'Hi' ,
48+ );
4649 profile = client.profile! ;
4750 });
4851 tearDownAll (() {
@@ -53,8 +56,10 @@ void main() {
5356 expect (profile.events, isEmpty);
5457 expect (profile.requestMethod, 'POST' );
5558 expect (profile.requestUri, successServerUri.toString ());
56- expect (profile.connectionInfo,
57- containsPair ('package' , 'package:cupertino_http' ));
59+ expect (
60+ profile.connectionInfo,
61+ containsPair ('package' , 'package:cupertino_http' ),
62+ );
5863 });
5964
6065 test ('request attributes' , () {
@@ -63,9 +68,13 @@ void main() {
6368 expect (profile.requestData.endTime, isNotNull);
6469 expect (profile.requestData.error, isNull);
6570 expect (
66- profile.requestData.headers, containsPair ('Content-Length' , ['2' ]));
67- expect (profile.requestData.headers,
68- containsPair ('Content-Type' , ['text/plain; charset=utf-8' ]));
71+ profile.requestData.headers,
72+ containsPair ('Content-Length' , ['2' ]),
73+ );
74+ expect (
75+ profile.requestData.headers,
76+ containsPair ('Content-Type' , ['text/plain; charset=utf-8' ]),
77+ );
6978 expect (profile.requestData.persistentConnection, isNull);
7079 expect (profile.requestData.proxyDetails, isNull);
7180 expect (profile.requestData.startTime, isNotNull);
@@ -77,10 +86,14 @@ void main() {
7786 expect (profile.responseData.contentLength, 11 );
7887 expect (profile.responseData.endTime, isNotNull);
7988 expect (profile.responseData.error, isNull);
80- expect (profile.responseData.headers,
81- containsPair ('content-type' , ['text/plain' ]));
82- expect (profile.responseData.headers,
83- containsPair ('content-length' , ['11' ]));
89+ expect (
90+ profile.responseData.headers,
91+ containsPair ('content-type' , ['text/plain' ]),
92+ );
93+ expect (
94+ profile.responseData.headers,
95+ containsPair ('content-length' , ['11' ]),
96+ );
8497 expect (profile.responseData.isRedirect, false );
8598 expect (profile.responseData.persistentConnection, isNull);
8699 expect (profile.responseData.reasonPhrase, 'OK' );
@@ -119,7 +132,8 @@ void main() {
119132 }
120133 }();
121134 unawaited (
122- request.sink.addStream (stream).then ((_) => request.sink.close ()));
135+ request.sink.addStream (stream).then ((_) => request.sink.close ()),
136+ );
123137
124138 await client.send (request);
125139 profile = client.profile! ;
@@ -143,8 +157,11 @@ void main() {
143157 setUpAll (() async {
144158 final client = CupertinoClientWithProfile .defaultSessionConfiguration ();
145159 try {
146- await client.post (Uri .http ('thisisnotahost' ),
147- headers: {'Content-Type' : 'text/plain' }, body: 'Hi' );
160+ await client.post (
161+ Uri .http ('thisisnotahost' ),
162+ headers: {'Content-Type' : 'text/plain' },
163+ body: 'Hi' ,
164+ );
148165 fail ('expected exception' );
149166 } on ClientException {
150167 // Expected exception.
@@ -156,20 +173,28 @@ void main() {
156173 expect (profile.events, isEmpty);
157174 expect (profile.requestMethod, 'POST' );
158175 expect (profile.requestUri, 'http://thisisnotahost' );
159- expect (profile.connectionInfo,
160- containsPair ('package' , 'package:cupertino_http' ));
176+ expect (
177+ profile.connectionInfo,
178+ containsPair ('package' , 'package:cupertino_http' ),
179+ );
161180 });
162181
163182 test ('request attributes' , () {
164183 expect (profile.requestData.bodyBytes, 'Hi' .codeUnits);
165184 expect (profile.requestData.contentLength, 2 );
166185 expect (profile.requestData.endTime, isNotNull);
167186 expect (
168- profile.requestData.error, startsWith ('NSErrorClientException:' ));
187+ profile.requestData.error,
188+ startsWith ('NSErrorClientException:' ),
189+ );
190+ expect (
191+ profile.requestData.headers,
192+ containsPair ('Content-Length' , ['2' ]),
193+ );
169194 expect (
170- profile.requestData.headers, containsPair ( 'Content-Length' , [ '2' ]));
171- expect (profile.requestData.headers ,
172- containsPair ( 'Content-Type' , [ 'text/plain; charset=utf-8' ]) );
195+ profile.requestData.headers,
196+ containsPair ( 'Content-Type' , [ 'text/plain; charset=utf-8' ]) ,
197+ );
173198 expect (profile.requestData.persistentConnection, isNull);
174199 expect (profile.requestData.proxyDetails, isNull);
175200 expect (profile.requestData.startTime, isNotNull);
@@ -209,8 +234,11 @@ void main() {
209234 final client = CupertinoClientWithProfile .defaultSessionConfiguration ();
210235
211236 try {
212- await client.post (successServerUri,
213- headers: {'Content-Type' : 'text/plain' }, body: 'Hi' );
237+ await client.post (
238+ successServerUri,
239+ headers: {'Content-Type' : 'text/plain' },
240+ body: 'Hi' ,
241+ );
214242 fail ('expected exception' );
215243 } on ClientException {
216244 // Expected exception.
@@ -225,8 +253,10 @@ void main() {
225253 expect (profile.events, isEmpty);
226254 expect (profile.requestMethod, 'POST' );
227255 expect (profile.requestUri, successServerUri.toString ());
228- expect (profile.connectionInfo,
229- containsPair ('package' , 'package:cupertino_http' ));
256+ expect (
257+ profile.connectionInfo,
258+ containsPair ('package' , 'package:cupertino_http' ),
259+ );
230260 });
231261
232262 test ('request attributes' , () {
@@ -235,9 +265,13 @@ void main() {
235265 expect (profile.requestData.endTime, isNotNull);
236266 expect (profile.requestData.error, isNull);
237267 expect (
238- profile.requestData.headers, containsPair ('Content-Length' , ['2' ]));
239- expect (profile.requestData.headers,
240- containsPair ('Content-Type' , ['text/plain; charset=utf-8' ]));
268+ profile.requestData.headers,
269+ containsPair ('Content-Length' , ['2' ]),
270+ );
271+ expect (
272+ profile.requestData.headers,
273+ containsPair ('Content-Type' , ['text/plain; charset=utf-8' ]),
274+ );
241275 expect (profile.requestData.persistentConnection, isNull);
242276 expect (profile.requestData.proxyDetails, isNull);
243277 expect (profile.requestData.startTime, isNotNull);
@@ -249,11 +283,17 @@ void main() {
249283 expect (profile.responseData.contentLength, 11 );
250284 expect (profile.responseData.endTime, isNotNull);
251285 expect (
252- profile.responseData.error, startsWith ('NSErrorClientException:' ));
253- expect (profile.responseData.headers,
254- containsPair ('content-type' , ['text/plain' ]));
255- expect (profile.responseData.headers,
256- containsPair ('content-length' , ['11' ]));
286+ profile.responseData.error,
287+ startsWith ('NSErrorClientException:' ),
288+ );
289+ expect (
290+ profile.responseData.headers,
291+ containsPair ('content-type' , ['text/plain' ]),
292+ );
293+ expect (
294+ profile.responseData.headers,
295+ containsPair ('content-length' , ['11' ]),
296+ );
257297 expect (profile.responseData.isRedirect, false );
258298 expect (profile.responseData.persistentConnection, isNull);
259299 expect (profile.responseData.reasonPhrase, 'OK' );
@@ -325,8 +365,11 @@ void main() {
325365 } else {
326366 final n = int .parse (request.requestedUri.pathSegments.last);
327367 final nextPath = n - 1 == 0 ? '' : '${n - 1 }' ;
328- unawaited (request.response
329- .redirect (successServerUri.replace (path: '/$nextPath ' )));
368+ unawaited (
369+ request.response.redirect (
370+ successServerUri.replace (path: '/$nextPath ' ),
371+ ),
372+ );
330373 }
331374 });
332375 successServerUri = Uri .http ('localhost:${successServer .port }' );
@@ -345,9 +388,11 @@ void main() {
345388
346389 test ('follow redirects' , () async {
347390 final client = CupertinoClientWithProfile .defaultSessionConfiguration ();
348- await client.send (Request ('GET' , successServerUri.replace (path: '/3' ))
349- ..followRedirects = true
350- ..maxRedirects = 4 );
391+ await client.send (
392+ Request ('GET' , successServerUri.replace (path: '/3' ))
393+ ..followRedirects = true
394+ ..maxRedirects = 4 ,
395+ );
351396 profile = client.profile! ;
352397
353398 expect (profile.requestData.followRedirects, true );
@@ -356,25 +401,29 @@ void main() {
356401
357402 expect (profile.responseData.redirects, [
358403 HttpProfileRedirectData (
359- statusCode: 302 ,
360- method: 'GET' ,
361- location: successServerUri.replace (path: '/2' ).toString ()),
404+ statusCode: 302 ,
405+ method: 'GET' ,
406+ location: successServerUri.replace (path: '/2' ).toString (),
407+ ),
362408 HttpProfileRedirectData (
363- statusCode: 302 ,
364- method: 'GET' ,
365- location: successServerUri.replace (path: '/1' ).toString ()),
409+ statusCode: 302 ,
410+ method: 'GET' ,
411+ location: successServerUri.replace (path: '/1' ).toString (),
412+ ),
366413 HttpProfileRedirectData (
367414 statusCode: 302 ,
368415 method: 'GET' ,
369416 location: successServerUri.replace (path: '/' ).toString (),
370- )
417+ ),
371418 ]);
372419 });
373420
374421 test ('no follow redirects' , () async {
375422 final client = CupertinoClientWithProfile .defaultSessionConfiguration ();
376- await client.send (Request ('GET' , successServerUri.replace (path: '/3' ))
377- ..followRedirects = false );
423+ await client.send (
424+ Request ('GET' , successServerUri.replace (path: '/3' ))
425+ ..followRedirects = false ,
426+ );
378427 profile = client.profile! ;
379428
380429 expect (profile.requestData.followRedirects, false );
0 commit comments