Added custom user-agent
This commit is contained in:
@@ -2,18 +2,23 @@ use std::collections::HashMap;
|
||||
|
||||
use reqwest::ClientBuilder;
|
||||
|
||||
use crate::dance_info::{CompState, DanceInfo, DanceRank, DanceRole};
|
||||
use crate::{
|
||||
app_signature,
|
||||
dance_info::{CompState, DanceInfo, DanceRank, DanceRole},
|
||||
};
|
||||
|
||||
// mod caching;
|
||||
pub async fn fetch_wsdc_info(id: u32) -> Result<DanceInfo, DanceInfoError> {
|
||||
let client = ClientBuilder::new()
|
||||
.user_agent(app_signature())
|
||||
.build()
|
||||
.map_err(DanceInfoError::ClientBuild)?;
|
||||
|
||||
let mut params = HashMap::new();
|
||||
|
||||
let url = if cfg!(test) {
|
||||
"https://o5grQU3Y.free.beeceptor.com/lookup2020/find"
|
||||
// "https://o5grQU3Y.free.beeceptor.com/lookup2020/find"
|
||||
"http://localhost:8000"
|
||||
} else {
|
||||
"https://points.worldsdc.com/lookup2020/find"
|
||||
};
|
||||
@@ -34,7 +39,7 @@ pub async fn fetch_wsdc_info(id: u32) -> Result<DanceInfo, DanceInfoError> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#![allow(clippy::unwrap_used, reason="Allow unwrap in tests")]
|
||||
#![allow(clippy::unwrap_used, reason = "Allow unwrap in tests")]
|
||||
use crate::worldsdc::fetch_wsdc_info;
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user