mirror of
https://gitlab.com/hladislav/radiobrowser-lib-rust.git
synced 2025-04-29 23:34:12 +00:00
set user agent
This commit is contained in:
parent
2582a64dff
commit
15bad37787
1 changed files with 6 additions and 1 deletions
|
@ -8,7 +8,12 @@ pub async fn post_api<P: DeserializeOwned, A: AsRef<str>, B: AsRef<str>>(
|
|||
endpoint: B,
|
||||
mapjson: HashMap<String, String>,
|
||||
) -> Result<P, Box<dyn Error>> {
|
||||
let client = reqwest::Client::new();
|
||||
static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
|
||||
|
||||
let client = reqwest::Client::builder()
|
||||
.user_agent(APP_USER_AGENT)
|
||||
.build()?;
|
||||
|
||||
let res = client
|
||||
.post(format!("{}{}", server.as_ref(), endpoint.as_ref()))
|
||||
.json(&mapjson)
|
||||
|
|
Loading…
Reference in a new issue