@@ -34,18 +34,18 @@ void main() {
3434 });
3535 }
3636
37- checkRequest (null , '/api/v1/example/route' );
38- checkRequest ({}, '/api/v1/example/route?' );
39- checkRequest ({'x' : 3 }, '/api/v1/example/route?x=3' );
40- checkRequest ({'x' : 3 , 'y' : 4 }, '/api/v1/example/route?x=3&y=4' );
41- checkRequest ({'x' : null }, '/api/v1/example/route?x=null' );
42- checkRequest ({'x' : true }, '/api/v1/example/route?x=true' );
43- checkRequest ({'x' : 'foo' }, '/api/v1/example/route?x=%22foo%22' );
44- checkRequest ({'x' : [1 , 2 ]}, '/api/v1/example/route?x=%5B1%2C2%5D' );
45- checkRequest ({'x' : {'y' : 1 }}, '/api/v1/example/route?x=%7B%22y%22%3A1%7D' );
46- checkRequest ({'x' : RawParameter ('foo' )},
37+ await checkRequest (null , '/api/v1/example/route' );
38+ await checkRequest ({}, '/api/v1/example/route?' );
39+ await checkRequest ({'x' : 3 }, '/api/v1/example/route?x=3' );
40+ await checkRequest ({'x' : 3 , 'y' : 4 }, '/api/v1/example/route?x=3&y=4' );
41+ await checkRequest ({'x' : null }, '/api/v1/example/route?x=null' );
42+ await checkRequest ({'x' : true }, '/api/v1/example/route?x=true' );
43+ await checkRequest ({'x' : 'foo' }, '/api/v1/example/route?x=%22foo%22' );
44+ await checkRequest ({'x' : [1 , 2 ]}, '/api/v1/example/route?x=%5B1%2C2%5D' );
45+ await checkRequest ({'x' : {'y' : 1 }}, '/api/v1/example/route?x=%7B%22y%22%3A1%7D' );
46+ await checkRequest ({'x' : RawParameter ('foo' )},
4747 '/api/v1/example/route?x=foo' );
48- checkRequest ({'x' : RawParameter ('foo' ), 'y' : 'bar' },
48+ await checkRequest ({'x' : RawParameter ('foo' ), 'y' : 'bar' },
4949 '/api/v1/example/route?x=foo&y=%22bar%22' );
5050 });
5151
@@ -67,17 +67,17 @@ void main() {
6767 });
6868 }
6969
70- checkRequest (null , '' , expectContentType: false );
71- checkRequest ({}, '' );
72- checkRequest ({'x' : 3 }, 'x=3' );
73- checkRequest ({'x' : 3 , 'y' : 4 }, 'x=3&y=4' );
74- checkRequest ({'x' : null }, 'x=null' );
75- checkRequest ({'x' : true }, 'x=true' );
76- checkRequest ({'x' : 'foo' }, 'x=%22foo%22' );
77- checkRequest ({'x' : [1 , 2 ]}, 'x=%5B1%2C2%5D' );
78- checkRequest ({'x' : {'y' : 1 }}, 'x=%7B%22y%22%3A1%7D' );
79- checkRequest ({'x' : RawParameter ('foo' )}, 'x=foo' );
80- checkRequest ({'x' : RawParameter ('foo' ), 'y' : 'bar' }, 'x=foo&y=%22bar%22' );
70+ await checkRequest (null , '' , expectContentType: false );
71+ await checkRequest ({}, '' );
72+ await checkRequest ({'x' : 3 }, 'x=3' );
73+ await checkRequest ({'x' : 3 , 'y' : 4 }, 'x=3&y=4' );
74+ await checkRequest ({'x' : null }, 'x=null' );
75+ await checkRequest ({'x' : true }, 'x=true' );
76+ await checkRequest ({'x' : 'foo' }, 'x=%22foo%22' );
77+ await checkRequest ({'x' : [1 , 2 ]}, 'x=%5B1%2C2%5D' );
78+ await checkRequest ({'x' : {'y' : 1 }}, 'x=%7B%22y%22%3A1%7D' );
79+ await checkRequest ({'x' : RawParameter ('foo' )}, 'x=foo' );
80+ await checkRequest ({'x' : RawParameter ('foo' ), 'y' : 'bar' }, 'x=foo&y=%22bar%22' );
8181 });
8282
8383 test ('ApiConnection.postFileFromStream' , () async {
@@ -111,18 +111,18 @@ void main() {
111111 });
112112 }
113113
114- checkRequest ([], 0 , filename: null );
115- checkRequest (['asdf' .codeUnits], 4 , filename: null );
116- checkRequest (['asd' .codeUnits, 'f' .codeUnits], 4 , filename: null );
114+ await checkRequest ([], 0 , filename: null );
115+ await checkRequest (['asdf' .codeUnits], 4 , filename: null );
116+ await checkRequest (['asd' .codeUnits, 'f' .codeUnits], 4 , filename: null );
117117
118- checkRequest (['asdf' .codeUnits], 4 , filename: 'info.txt' );
119- checkRequest (['asdf' .codeUnits], 4 ,
118+ await checkRequest (['asdf' .codeUnits], 4 , filename: 'info.txt' );
119+ await checkRequest (['asdf' .codeUnits], 4 ,
120120 filename: 'image.jpg' , contentType: 'image/jpeg' );
121- checkRequest (['asdf' .codeUnits], 4 ,
121+ await checkRequest (['asdf' .codeUnits], 4 ,
122122 filename: 'image.jpg' , contentType: 'asdfjkl;' , isContentTypeInvalid: true );
123123
124- checkRequest (['asdf' .codeUnits], 1 , filename: null ); // nothing on client side catches a wrong length
125- checkRequest (['asdf' .codeUnits], 100 , filename: null );
124+ await checkRequest (['asdf' .codeUnits], 1 , filename: null ); // nothing on client side catches a wrong length
125+ await checkRequest (['asdf' .codeUnits], 100 , filename: null );
126126 });
127127
128128 test ('ApiConnection.delete' , () async {
@@ -143,17 +143,17 @@ void main() {
143143 });
144144 }
145145
146- checkRequest (null , '' , expectContentType: false );
147- checkRequest ({}, '' );
148- checkRequest ({'x' : 3 }, 'x=3' );
149- checkRequest ({'x' : 3 , 'y' : 4 }, 'x=3&y=4' );
150- checkRequest ({'x' : null }, 'x=null' );
151- checkRequest ({'x' : true }, 'x=true' );
152- checkRequest ({'x' : 'foo' }, 'x=%22foo%22' );
153- checkRequest ({'x' : [1 , 2 ]}, 'x=%5B1%2C2%5D' );
154- checkRequest ({'x' : {'y' : 1 }}, 'x=%7B%22y%22%3A1%7D' );
155- checkRequest ({'x' : RawParameter ('foo' )}, 'x=foo' );
156- checkRequest ({'x' : RawParameter ('foo' ), 'y' : 'bar' }, 'x=foo&y=%22bar%22' );
146+ await checkRequest (null , '' , expectContentType: false );
147+ await checkRequest ({}, '' );
148+ await checkRequest ({'x' : 3 }, 'x=3' );
149+ await checkRequest ({'x' : 3 , 'y' : 4 }, 'x=3&y=4' );
150+ await checkRequest ({'x' : null }, 'x=null' );
151+ await checkRequest ({'x' : true }, 'x=true' );
152+ await checkRequest ({'x' : 'foo' }, 'x=%22foo%22' );
153+ await checkRequest ({'x' : [1 , 2 ]}, 'x=%5B1%2C2%5D' );
154+ await checkRequest ({'x' : {'y' : 1 }}, 'x=%7B%22y%22%3A1%7D' );
155+ await checkRequest ({'x' : RawParameter ('foo' )}, 'x=foo' );
156+ await checkRequest ({'x' : RawParameter ('foo' ), 'y' : 'bar' }, 'x=foo&y=%22bar%22' );
157157 });
158158
159159 test ('API success result' , () async {
@@ -176,13 +176,13 @@ void main() {
176176 }
177177
178178 final zulipLocalizations = GlobalLocalizations .zulipLocalizations;
179- checkRequest (http.ClientException ('Oops' ), (it) => it
179+ await checkRequest (http.ClientException ('Oops' ), (it) => it
180180 ..message.equals ('Oops' )
181181 ..asString.equals ('NetworkException: Oops (ClientException: Oops)' ));
182- checkRequest (const TlsException ('Oops' ), (it) => it
182+ await checkRequest (const TlsException ('Oops' ), (it) => it
183183 ..message.equals ('Oops' )
184184 ..asString.equals ('NetworkException: Oops (TlsException: Oops)' ));
185- checkRequest ((foo: 'bar' ), (it) => it
185+ await checkRequest ((foo: 'bar' ), (it) => it
186186 ..message.equals (zulipLocalizations.errorNetworkRequestFailed)
187187 ..asString.equals ('NetworkException: Network request failed ((foo: bar))' ));
188188 });
@@ -233,17 +233,17 @@ void main() {
233233 tryRequest (json: { 'result' : 'error' , 'code' : 'ERR' , 'msg' : 'Oops' }, httpStatus: 400 ),
234234 ).throws <ZulipApiException >();
235235
236- checkMalformed (json: {'result' : 'success' , 'code' : 'ERR' , 'msg' : 'Oops' });
237- checkMalformed (json: {'result' : 'nonsense' , 'code' : 'ERR' , 'msg' : 'Oops' });
238- checkMalformed (json: {/* result */ 'code' : 'ERR' , 'msg' : 'Oops' });
239- checkMalformed (json: {'result' : 'error' , 'code' : 1 , 'msg' : 'Oops' });
240- checkMalformed (json: {'result' : 'error' , 'code' : 'ERR' /* msg */ });
241- checkMalformed (json: {'result' : 'error' , 'code' : 'ERR' , 'msg' : 1 });
242- checkMalformed (json: {});
243- checkMalformed (body: '' );
244- checkMalformed (body: '<html><body><p>An error occurred</p></body></html>' );
245- checkMalformed (json: {'result' : 'nonsense' }, httpStatus: 401 );
246- checkMalformed (json: {'result' : 'nonsense' }, httpStatus: 499 );
236+ await checkMalformed (json: {'result' : 'success' , 'code' : 'ERR' , 'msg' : 'Oops' });
237+ await checkMalformed (json: {'result' : 'nonsense' , 'code' : 'ERR' , 'msg' : 'Oops' });
238+ await checkMalformed (json: {/* result */ 'code' : 'ERR' , 'msg' : 'Oops' });
239+ await checkMalformed (json: {'result' : 'error' , 'code' : 1 , 'msg' : 'Oops' });
240+ await checkMalformed (json: {'result' : 'error' , 'code' : 'ERR' /* msg */ });
241+ await checkMalformed (json: {'result' : 'error' , 'code' : 'ERR' , 'msg' : 1 });
242+ await checkMalformed (json: {});
243+ await checkMalformed (body: '' );
244+ await checkMalformed (body: '<html><body><p>An error occurred</p></body></html>' );
245+ await checkMalformed (json: {'result' : 'nonsense' }, httpStatus: 401 );
246+ await checkMalformed (json: {'result' : 'nonsense' }, httpStatus: 499 );
247247 });
248248
249249 test ('API 5xx errors' , () async {
0 commit comments