Skip to content

Commit 42251ea

Browse files
committed
Changed POST to GET and ensured of some tests
1 parent f65dd4f commit 42251ea

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pkgs/http/test/html/cache_test.dart

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,42 +41,41 @@ void main() {
4141
client.close();
4242
});
4343

44-
test('#send a POST with no-cache type', () async {
44+
test('#send a GET with no-cache type', () async {
4545
var client = BrowserClient(cacheMode: CacheMode.noCache);
4646

47-
await client.post(url);
48-
var response = await client.post(url);
47+
await client.get(url);
48+
var response = await client.get(url);
4949
client.close();
5050
expect(
5151
response.body,
5252
parse(anyOf(containsPair('numOfRequests', 2),
5353
containsPair('cache-control', ['max-age=0']))));
5454
});
5555

56-
test('#send a POST with no-store type', () async {
56+
test('#send a GET with no-store type', () async {
5757
var client = BrowserClient(cacheMode: CacheMode.noStore);
5858

59-
await client.post(url);
60-
var response = await client.post(url);
59+
await client.get(url);
60+
var response = await client.get(url);
6161
client.close();
6262
expect(response.body, parse(allOf(containsPair('numOfRequests', 2))));
6363
});
6464

65-
test('#send a POST with force-store type', () async {
65+
test('#send a GET with force-store type', () async {
6666
var client = BrowserClient(cacheMode: CacheMode.forceCache);
6767

68-
await client.post(url);
69-
var response = await client.post(url);
68+
await client.get(url);
69+
var response = await client.get(url);
7070
client.close();
71-
expect(response.body, parse(allOf(containsPair('numOfRequests', 2))));
71+
expect(response.body, parse(allOf(containsPair('numOfRequests', 1))));
7272
});
7373

7474
test('#send a StreamedRequest with only-if-cached type', () {
7575
var client = BrowserClient(cacheMode: CacheMode.onlyIfCached);
76-
var request = http.StreamedRequest('POST', url);
76+
var request = http.StreamedRequest('GET', url);
7777

7878
expectLater(client.send(request), throwsA(isA<ClientException>()));
79-
request.sink.add('{"hello": "world"}'.codeUnits);
8079
unawaited(request.sink.close());
8180

8281
client.close();

0 commit comments

Comments
 (0)