Skip to content

Commit

Permalink
🐛 Add user agent header to GitHub req
Browse files Browse the repository at this point in the history
  • Loading branch information
malted committed Feb 8, 2024
1 parent 962d00c commit 77378fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/api/api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::MaltedState;
use parking_lot::RwLock;
use reqwest::header::{ACCEPT, AUTHORIZATION};
use reqwest::header::{ACCEPT, AUTHORIZATION, USER_AGENT};
use rocket::{serde::json::Json, State};

#[derive(serde::Serialize)]
Expand Down Expand Up @@ -65,6 +65,7 @@ pub fn patch_location(
let res = match reqwest::blocking::Client::new()
.patch("https://api.github.com/user")
.header(ACCEPT, "application/vnd.github+json")
.header(USER_AGENT, "malted/malted.dev")
.header(AUTHORIZATION, format!("Bearer {}", github_pat))
.header("X-GitHub-Api-Version", "2022-11-28")
.json(&serde_json::json!({ "location": format!("{}, {}", city, country) }))
Expand Down

0 comments on commit 77378fa

Please sign in to comment.