File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
crates/crates_io_github/src Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -61,17 +61,22 @@ impl RealGitHubClient {
6161 let url = format ! ( "https://api.github.com{url}" ) ;
6262 info ! ( "GITHUB HTTP: {url}" ) ;
6363
64- self . client
64+ let response = self
65+ . client
6566 . get ( & url)
6667 . header ( header:: ACCEPT , "application/vnd.github.v3+json" )
6768 . header ( header:: AUTHORIZATION , auth)
6869 . header ( header:: USER_AGENT , "crates.io (https://crates.io)" )
6970 . send ( )
7071 . await ?
71- . error_for_status ( ) ?
72- . json ( )
73- . await
74- . map_err ( Into :: into)
72+ . error_for_status ( ) ?;
73+
74+ let headers = response. headers ( ) ;
75+ let remaining = headers. get ( "x-ratelimit-remaining" ) ;
76+ let limit = headers. get ( "x-ratelimit-limit" ) ;
77+ debug ! ( "GitHub rate limit remaining: {remaining:?}/{limit:?}" ) ;
78+
79+ response. json ( ) . await . map_err ( Into :: into)
7580 }
7681
7782 /// Sends a GET to GitHub using OAuth access token authentication
You can’t perform that action at this time.
0 commit comments