summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-07-14 21:55:03 +0200
committerCyborus <cyborus@cyborus.xyz>2024-07-14 21:55:03 +0200
commit5a3a71eddd57f0fd38fcf334cf95ae73af250cfa (patch)
tree73e6b5c80e39f3d2b6dbdede74993bc6869d36db /generator
parentMerge pull request 'sign integers by default' (#66) from signed-int-default i... (diff)
downloadforgejo-api-5a3a71eddd57f0fd38fcf334cf95ae73af250cfa.tar.xz
forgejo-api-5a3a71eddd57f0fd38fcf334cf95ae73af250cfa.zip
fix: correct body parsing for each status code
Diffstat (limited to 'generator')
-rw-r--r--generator/src/methods.rs3
1 files changed, 2 insertions, 1 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<Stri
out.push_str("let response = self.execute(request).await?;\n");
out.push_str("match response.status().as_u16() {\n");
for (code, res) in &op.responses.http_codes {
+ let branch_ret = response_ref_type_name(spec, res, op)?;
let res = res.deref(spec)?;
if !code.starts_with("2") {
continue;
@@ -491,7 +492,7 @@ fn create_method_response(spec: &OpenApiV2, op: &Operation) -> eyre::Result<Stri
}
};
handlers.extend(header_handler);
- let body_handler = match fn_ret.kind {
+ let body_handler = match branch_ret.kind {
Some(ResponseKind::Text) => {
if optional {
Some("Some(response.text().await?)")