Skip to content

Commit

Permalink
Actually add default headers for GitHub client
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Levick <me@ryanlevick.com>
  • Loading branch information
rylev committed Jan 19, 2024
1 parent d6f07f3 commit 3f8d401
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/github/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) struct HttpClient {

impl HttpClient {
pub(crate) fn from_url_and_token(mut base_url: String, token: String) -> anyhow::Result<Self> {
let builder = reqwest::blocking::ClientBuilder::default();
let mut builder = reqwest::blocking::ClientBuilder::default();
let mut map = HeaderMap::default();
let mut auth = HeaderValue::from_str(&format!("token {}", token))?;
auth.set_sensitive(true);
Expand All @@ -36,6 +36,7 @@ impl HttpClient {
header::USER_AGENT,
HeaderValue::from_static(crate::USER_AGENT),
);
builder = builder.default_headers(map);

if !base_url.ends_with('/') {
base_url.push('/');
Expand Down

0 comments on commit 3f8d401

Please sign in to comment.