File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
packages/aws_common/test/http Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import 'package:aws_common/aws_common.dart' ;
5
+ import 'package:test/test.dart' ;
6
+
7
+ final expiredCertUrl = Uri .parse ('https://expired.badssl.com/' );
8
+
9
+ void main () {
10
+ group ('AWSHttpClient' , () {
11
+ test ('throws by default for expired certificates' , () async {
12
+ final client = AWSHttpClient ();
13
+ final request = AWSHttpRequest .get (expiredCertUrl);
14
+ final operation = client.send (request);
15
+ await expectLater (
16
+ operation.response,
17
+ throwsA (isA <AWSHttpException >()),
18
+ );
19
+ });
20
+
21
+ test (
22
+ 'does not throw when onBadCertificate is overridden' ,
23
+ () async {
24
+ final client = AWSHttpClient ()
25
+ ..onBadCertificate = (p0, host, port) => true ;
26
+ final request = AWSHttpRequest .get (expiredCertUrl);
27
+ final operation = client.send (request);
28
+ expect (
29
+ operation.response,
30
+ completes,
31
+ );
32
+ },
33
+ // onBadCertificate override is only used on vm
34
+ skip: zIsWeb,
35
+ );
36
+ });
37
+ }
You can’t perform that action at this time.
0 commit comments