File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 8
8
],
9
9
"auth" : " perl6" ,
10
10
"test-depends" : [
11
+ " Cro::HTTP::Client" ,
11
12
" HTTP::UserAgent" ,
12
- " HTTP::Tiny" ,
13
13
" File::Temp" ,
14
14
" Test::META" ,
15
15
" Doc::TypeGraph"
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ use lib $*PROGRAM.parent(2).child('lib');
11
11
12
12
use Test-Files;
13
13
use Pod ::Convenience;
14
+ use Cro::HTTP::Client;
14
15
15
16
my @ files = Test-Files. pods;
16
17
@@ -20,6 +21,7 @@ if @files {
20
21
plan : skip-all<No rakudoc files specified >
21
22
}
22
23
24
+ my $ ua = Cro::HTTP::Client. new ;
23
25
24
26
sub is-valid-display ($ content ) {
25
27
if $ content . starts-with (' #' ) {
@@ -92,9 +94,24 @@ sub is-valid-link($links) {
92
94
} else {
93
95
my @ valid-protocols = <http https >;
94
96
if $ link . starts-with (any (@ valid-protocols ) ~ ' ://' ) {
95
- use HTTP::Tiny;
96
- my $ response = HTTP::Tiny. new . get : $ link ;
97
- ok ($ response <success >, " HTTP $ response <status> $ link" );
97
+ my $ response = await $ ua . get : $ link ;
98
+ CATCH {
99
+ when X::Cro::HTTP::Error {
100
+ if . response. status == 429 {
101
+ my $ retry-after = . response. header(' retry-after' );
102
+ sleep $ retry-after ;
103
+ redo ;
104
+ } else {
105
+ flunk " HTTP { . response. status} $ link" ;
106
+ }
107
+ }
108
+ default {
109
+ diag .^ name ;
110
+ flunk " HTTP Unknown error: $ link" ;
111
+ }
112
+ next ;
113
+ }
114
+ pass " HTTP { $ response . status} $ link" ;
98
115
next ;
99
116
}
100
117
You can’t perform that action at this time.
0 commit comments