From a496f364b6388bd2122eca4e63cad6ab8f0eaef4 Mon Sep 17 00:00:00 2001 From: Dovydas Date: Thu, 22 Aug 2024 19:05:19 +0300 Subject: [PATCH] accept other 2XX codes as OK --- Cargo.toml | 2 +- src/alby/helpers.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cdf11ed..6858b97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["RSS Blue", "Dovydas Joksas"] name = "v4v" -version = "0.5.8" +version = "0.5.9" edition = "2021" description = "Value-for-value helper utilities for Podcasting 2.0" license = "MIT OR Apache-2.0" diff --git a/src/alby/helpers.rs b/src/alby/helpers.rs index 6ebcde0..ce5fa3f 100644 --- a/src/alby/helpers.rs +++ b/src/alby/helpers.rs @@ -144,7 +144,9 @@ pub async fn make_request(args: RequestArgs<'_>) -> Result< println!("{}", body); match status.as_u16() { - 200 => Ok(serde_json::from_str(&body).map_err(|e| RequestError::ResponseParse(e, body))?), + 200..299 => { + Ok(serde_json::from_str(&body).map_err(|e| RequestError::ResponseParse(e, body))?) + } 400 => { let error_response: ErrorResponse = serde_json::from_str(&body) .map_err(|e| RequestError::ResponseParse(e, body.clone()))?;