Add user agent to HTTP requests
This commit is contained in:
parent
bc9ca47e3e
commit
3c27383bbc
|
@ -2,6 +2,7 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use {
|
||||
crate::constants::USER_AGENT,
|
||||
anyhow::{anyhow, Result},
|
||||
reqwest::{StatusCode, Url},
|
||||
serde::{Deserialize, Serialize},
|
||||
|
@ -46,7 +47,9 @@ impl Credentials {
|
|||
}
|
||||
|
||||
pub fn add(&mut self, server: Url) -> Result<()> {
|
||||
let http_client = reqwest::blocking::Client::new();
|
||||
let http_client = reqwest::blocking::Client::builder()
|
||||
.user_agent(USER_AGENT)
|
||||
.build()?;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct LoginFlow {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-FileCopyrightText: 2022 Matteo Settenvini <matteo.settenvini@montecristosoftware.eu>
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
pub const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
|
|
@ -2,6 +2,7 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
mod config;
|
||||
mod constants;
|
||||
|
||||
use {
|
||||
self::config::Config,
|
||||
|
|
Loading…
Reference in New Issue