accept int or string in api

This commit is contained in:
Simon
2026-02-08 15:42:58 +00:00
parent 7b1bb758e3
commit 310dfd71e9
2 changed files with 25 additions and 13 deletions

View File

@@ -1029,18 +1029,14 @@ async fn videos_post(
}
let page: u8 = video_request
.page
.as_deref()
.unwrap_or("1")
.to_string()
.parse()
.unwrap();
.as_ref()
.and_then(|value| value.to_u8())
.unwrap_or(1);
let perPage: u8 = video_request
.perPage
.as_deref()
.unwrap_or("10")
.to_string()
.parse()
.unwrap();
.as_ref()
.and_then(|value| value.to_u8())
.unwrap_or(10);
let featured = video_request
.featured
.as_deref()
@@ -1199,4 +1195,4 @@ pub async fn test() -> Result<impl web::Responder, web::Error> {
).await;
Ok(web::HttpResponse::Ok())
}
}