From 5a3a71eddd57f0fd38fcf334cf95ae73af250cfa Mon Sep 17 00:00:00 2001 From: Cyborus Date: Sun, 14 Jul 2024 15:55:03 -0400 Subject: fix: correct body parsing for each status code --- generator/src/methods.rs | 3 ++- src/generated/methods.rs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/generator/src/methods.rs b/generator/src/methods.rs index 75bb7db..8039f96 100644 --- a/generator/src/methods.rs +++ b/generator/src/methods.rs @@ -462,6 +462,7 @@ fn create_method_response(spec: &OpenApiV2, op: &Operation) -> eyre::Result eyre::Result { if optional { Some("Some(response.text().await?)") diff --git a/src/generated/methods.rs b/src/generated/methods.rs index 621b3c9..7eeb1b0 100644 --- a/src/generated/methods.rs +++ b/src/generated/methods.rs @@ -2799,7 +2799,7 @@ impl crate::Forgejo { let response = self.execute(request).await?; match response.status().as_u16() { 200 => Ok(Some(response.json().await?)), - 204 => Ok(Some(response.json().await?)), + 204 => Ok(None), _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), } } @@ -2845,7 +2845,7 @@ impl crate::Forgejo { let response = self.execute(request).await?; match response.status().as_u16() { 200 => Ok(Some(response.json().await?)), - 204 => Ok(Some(response.json().await?)), + 204 => Ok(None), _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), } } @@ -3448,7 +3448,7 @@ impl crate::Forgejo { let response = self.execute(request).await?; match response.status().as_u16() { 200 => Ok(Some(response.json().await?)), - 204 => Ok(Some(response.json().await?)), + 204 => Ok(None), _ => Err(ForgejoError::UnexpectedStatusCode(response.status())), } } -- cgit v1.2.3