Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/lib/docs_rs_repository_stats/src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl GitHub {
if let Some(ref token) = config.github_accesstoken {
headers.insert(
AUTHORIZATION,
HeaderValue::from_str(&format!("token {token}"))?,
HeaderValue::from_str(&format!("Bearer {token}"))?,
);
} else {
warn!("did not collect `github.com` stats as no token was provided");
Expand Down Expand Up @@ -268,6 +268,7 @@ mod tests {
};
use anyhow::Result;
use docs_rs_config::AppConfig as _;
use reqwest::header::AUTHORIZATION;

const TEST_TOKEN: &str = "qsjdnfqdq";

Expand Down Expand Up @@ -297,6 +298,7 @@ mod tests {
.with_body(
r#"{"errors":[{"type":"RATE_LIMITED","message":"API rate limit exceeded"}]}"#,
)
.match_header(AUTHORIZATION, format!("Bearer {TEST_TOKEN}").as_str())
.create();

match updater.fetch_repositories(&[String::new()]).await {
Expand All @@ -315,6 +317,7 @@ mod tests {
.mock("POST", "/graphql")
.with_header("content-type", "application/json")
.with_body(r#"{"data": {"nodes": [], "rateLimit": {"remaining": 0}}}"#)
.match_header(AUTHORIZATION, format!("Bearer {TEST_TOKEN}").as_str())
.create();

match updater.fetch_repositories(&[String::new()]).await {
Expand All @@ -336,6 +339,7 @@ mod tests {
r#"{"data": {"nodes": [], "rateLimit": {"remaining": 100000}}, "errors":
[{"type": "NOT_FOUND", "path": ["nodes", 0], "message": "none"}]}"#,
)
.match_header(AUTHORIZATION, format!("Bearer {TEST_TOKEN}").as_str())
.create();

match updater.fetch_repositories(&[String::new()]).await {
Expand All @@ -361,6 +365,7 @@ mod tests {
"description": "this is", "stargazerCount": 10, "forkCount": 11,
"issues": {"totalCount": 12}}}}"#,
)
.match_header(AUTHORIZATION, format!("Bearer {TEST_TOKEN}").as_str())
.create();

let repo = updater
Expand Down
Loading