diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache index dc0cf75205c0..b96063531e61 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api.mustache @@ -80,7 +80,7 @@ pub enum {{{operationIdCamelCase}}}Error { /// {{{.}}} {{/notes}} {{#vendorExtensions.x-group-parameters}} -pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> { +pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration{{#allParams}}{{#-first}}, params: {{{operationIdCamelCase}}}Params{{/-first}}{{/allParams}}) -> Result<{{#isResponseFile}}{{#supportAsync}}reqwest::Response{{/supportAsync}}{{^supportAsync}}reqwest::blocking::Response{{/supportAsync}}{{/isResponseFile}}{{^isResponseFile}}{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}{{/isResponseFile}}, Error<{{{operationIdCamelCase}}}Error>> { let local_var_configuration = configuration; // unbox the parameters @@ -90,7 +90,7 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: {{/vendorExtensions.x-group-parameters}} {{^vendorExtensions.x-group-parameters}} -pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> { +pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: &configuration::Configuration, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#isResponseFile}}{{#supportAsync}}reqwest::Response{{/supportAsync}}{{^supportAsync}}reqwest::blocking::Response{{/supportAsync}}{{/isResponseFile}}{{^isResponseFile}}{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}{{/isResponseFile}}, Error<{{{operationIdCamelCase}}}Error>> { let local_var_configuration = configuration; {{/vendorExtensions.x-group-parameters}} @@ -346,7 +346,12 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: {{/isMultipart}} {{#hasBodyParam}} {{#bodyParams}} + {{#isFile}} + local_var_req_builder = local_var_req_builder.body({{{paramName}}}); + {{/isFile}} + {{^isFile}} local_var_req_builder = local_var_req_builder.json(&{{{paramName}}}); + {{/isFile}} {{/bodyParams}} {{/hasBodyParam}} @@ -354,23 +359,35 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration: let local_var_resp = local_var_client.execute(local_var_req){{#supportAsync}}.await{{/supportAsync}}?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { {{^supportMultipleResponses}} + {{#isResponseFile}} + Ok(local_var_resp) + {{/isResponseFile}} + {{^isResponseFile}} {{^returnType}} Ok(()) {{/returnType}} {{#returnType}} + let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?; serde_json::from_str(&local_var_content).map_err(Error::from) {{/returnType}} + {{/isResponseFile}} {{/supportMultipleResponses}} {{#supportMultipleResponses}} + {{#isResponseFile}} + Ok(local_var_resp) + {{/isResponseFile}} + {{^isResponseFile}} + let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?; let local_var_entity: Option<{{{operationIdCamelCase}}}Success> = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) + {{/isResponseFile}} {{/supportMultipleResponses}} } else { + let local_var_content = local_var_resp.text(){{#supportAsync}}.await{{/supportAsync}}?; let local_var_entity: Option<{{{operationIdCamelCase}}}Error> = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs index 3886a83c9543..bea5f638a6e7 100644 --- a/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest-regression-16119/src/apis/default_api.rs @@ -39,11 +39,12 @@ pub fn repro(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs b/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs index 27a37acccf49..179f9ea5c141 100644 --- a/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/api-with-ref-param/src/apis/default_api.rs @@ -39,11 +39,11 @@ pub async fn demo_color_get(configuration: &configuration::Configuration, color: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs index 59d4035053a9..c0def694ddee 100644 --- a/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/composed-oneof/src/apis/default_api.rs @@ -47,11 +47,11 @@ pub fn create_state(configuration: &configuration::Configuration, create_state_r let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -74,11 +74,12 @@ pub fn get_state(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs b/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs index 5f5b46edc2c8..54b21d9c0766 100644 --- a/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/emptyObject/src/apis/default_api.rs @@ -39,11 +39,12 @@ pub fn endpoint_get(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs b/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs index c487220374ea..9fc93a60045b 100644 --- a/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/oneOf-array-map/src/apis/default_api.rs @@ -46,11 +46,12 @@ pub fn root_get(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -74,11 +75,11 @@ pub fn test(configuration: &configuration::Configuration, body: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs index 035872574bf6..3287c9177b3e 100644 --- a/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs +++ b/samples/client/others/rust/reqwest/oneOf-reuseRef/src/apis/default_api.rs @@ -39,11 +39,12 @@ pub fn get_fruit(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs index f8ce13d5cac6..fc6b75d5ebcd 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/bar_api.rs @@ -40,11 +40,12 @@ pub fn create_bar(configuration: &configuration::Configuration, bar_create: mode let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs index 202e6bb66793..cdcd1feaf2a5 100644 --- a/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs +++ b/samples/client/others/rust/reqwest/oneOf/src/apis/foo_api.rs @@ -47,11 +47,12 @@ pub fn create_foo(configuration: &configuration::Configuration, foo: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -74,11 +75,12 @@ pub fn get_all_foos(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs index e7f8c27a8f05..1dd40a13d980 100644 --- a/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/name-mapping/src/apis/fake_api.rs @@ -44,11 +44,11 @@ pub fn get_parameter_name_mapping(configuration: &configuration::Configuration, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs index 3f10b5b6c2af..f93b447840da 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/fake_api.rs @@ -74,13 +74,14 @@ pub async fn test_nullable_required_param(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs index 0a44b19a32dd..471556f03bd7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/pet_api.rs @@ -234,13 +234,14 @@ pub async fn add_pet(configuration: &configuration::Configuration, params: AddPe let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -275,13 +276,14 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -316,13 +318,14 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -357,13 +360,14 @@ pub async fn find_pets_by_tags(configuration: &configuration::Configuration, par let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -399,13 +403,14 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -437,13 +442,14 @@ pub async fn update_pet(configuration: &configuration::Configuration, params: Up let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -484,13 +490,14 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration, let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -529,13 +536,14 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs index 67fd03a80f54..340e6f2dc97c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/store_api.rs @@ -122,13 +122,14 @@ pub async fn delete_order(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -163,13 +164,14 @@ pub async fn get_inventory(configuration: &configuration::Configuration) -> Resu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -197,13 +199,14 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -232,13 +235,14 @@ pub async fn place_order(configuration: &configuration::Configuration, params: P let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs index 83d1a00fb4ce..0dafccec4b72 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/testing_api.rs @@ -46,7 +46,7 @@ pub enum TestsTypeTestingGetError { } -pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result, Error> { +pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result> { let local_var_configuration = configuration; // unbox the parameters @@ -65,13 +65,11 @@ pub async fn tests_file_response_get(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Ok(local_var_result) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -97,13 +95,14 @@ pub async fn tests_type_testing_get(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs index 4f28c21c1cf3..985f3b65e317 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-middleware/src/apis/user_api.rs @@ -224,13 +224,14 @@ pub async fn create_user(configuration: &configuration::Configuration, params: C let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -267,13 +268,14 @@ pub async fn create_users_with_array_input(configuration: &configuration::Config let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -310,13 +312,14 @@ pub async fn create_users_with_list_input(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -352,13 +355,14 @@ pub async fn delete_user(configuration: &configuration::Configuration, params: D let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -386,13 +390,14 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, para let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -423,13 +428,14 @@ pub async fn login_user(configuration: &configuration::Configuration, params: Lo let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -464,13 +470,14 @@ pub async fn logout_user(configuration: &configuration::Configuration) -> Result let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -508,13 +515,14 @@ pub async fn update_user(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/fake_api.rs index 3f10b5b6c2af..f93b447840da 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/fake_api.rs @@ -74,13 +74,14 @@ pub async fn test_nullable_required_param(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs index 7901fb0c40d9..55fffa82b61a 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/pet_api.rs @@ -236,13 +236,14 @@ pub async fn add_pet(configuration: &configuration::Configuration, params: AddPe let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -279,13 +280,14 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -322,13 +324,14 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -365,13 +368,14 @@ pub async fn find_pets_by_tags(configuration: &configuration::Configuration, par let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -404,13 +408,14 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -444,13 +449,14 @@ pub async fn update_pet(configuration: &configuration::Configuration, params: Up let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -493,13 +499,14 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration, let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -540,13 +547,14 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/store_api.rs index 2531e6306757..ef3f71dbb9cf 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/store_api.rs @@ -122,13 +122,14 @@ pub async fn delete_order(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -160,13 +161,14 @@ pub async fn get_inventory(configuration: &configuration::Configuration) -> Resu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -194,13 +196,14 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -229,13 +232,14 @@ pub async fn place_order(configuration: &configuration::Configuration, params: P let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs index 83d1a00fb4ce..0dafccec4b72 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/testing_api.rs @@ -46,7 +46,7 @@ pub enum TestsTypeTestingGetError { } -pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result, Error> { +pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result> { let local_var_configuration = configuration; // unbox the parameters @@ -65,13 +65,11 @@ pub async fn tests_file_response_get(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Ok(local_var_result) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -97,13 +95,14 @@ pub async fn tests_type_testing_get(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/user_api.rs index 0c62352279db..b5b830ac64a1 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async-tokensource/src/apis/user_api.rs @@ -221,13 +221,14 @@ pub async fn create_user(configuration: &configuration::Configuration, params: C let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -261,13 +262,14 @@ pub async fn create_users_with_array_input(configuration: &configuration::Config let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -301,13 +303,14 @@ pub async fn create_users_with_list_input(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -340,13 +343,14 @@ pub async fn delete_user(configuration: &configuration::Configuration, params: D let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -374,13 +378,14 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, para let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -411,13 +416,14 @@ pub async fn login_user(configuration: &configuration::Configuration, params: Lo let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -449,13 +455,14 @@ pub async fn logout_user(configuration: &configuration::Configuration) -> Result let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -490,13 +497,14 @@ pub async fn update_user(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs index 3f10b5b6c2af..f93b447840da 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/fake_api.rs @@ -74,13 +74,14 @@ pub async fn test_nullable_required_param(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs index 0a44b19a32dd..471556f03bd7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/pet_api.rs @@ -234,13 +234,14 @@ pub async fn add_pet(configuration: &configuration::Configuration, params: AddPe let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -275,13 +276,14 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -316,13 +318,14 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -357,13 +360,14 @@ pub async fn find_pets_by_tags(configuration: &configuration::Configuration, par let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -399,13 +403,14 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -437,13 +442,14 @@ pub async fn update_pet(configuration: &configuration::Configuration, params: Up let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -484,13 +490,14 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration, let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -529,13 +536,14 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs index 67fd03a80f54..340e6f2dc97c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/store_api.rs @@ -122,13 +122,14 @@ pub async fn delete_order(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -163,13 +164,14 @@ pub async fn get_inventory(configuration: &configuration::Configuration) -> Resu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -197,13 +199,14 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -232,13 +235,14 @@ pub async fn place_order(configuration: &configuration::Configuration, params: P let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs index 83d1a00fb4ce..0dafccec4b72 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/testing_api.rs @@ -46,7 +46,7 @@ pub enum TestsTypeTestingGetError { } -pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result, Error> { +pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result> { let local_var_configuration = configuration; // unbox the parameters @@ -65,13 +65,11 @@ pub async fn tests_file_response_get(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Ok(local_var_result) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -97,13 +95,14 @@ pub async fn tests_type_testing_get(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs index 4f28c21c1cf3..985f3b65e317 100644 --- a/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-async/src/apis/user_api.rs @@ -224,13 +224,14 @@ pub async fn create_user(configuration: &configuration::Configuration, params: C let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -267,13 +268,14 @@ pub async fn create_users_with_array_input(configuration: &configuration::Config let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -310,13 +312,14 @@ pub async fn create_users_with_list_input(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -352,13 +355,14 @@ pub async fn delete_user(configuration: &configuration::Configuration, params: D let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -386,13 +390,14 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, para let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -423,13 +428,14 @@ pub async fn login_user(configuration: &configuration::Configuration, params: Lo let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -464,13 +470,14 @@ pub async fn logout_user(configuration: &configuration::Configuration) -> Result let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -508,13 +515,14 @@ pub async fn update_user(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs index 3f10b5b6c2af..f93b447840da 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/fake_api.rs @@ -74,13 +74,14 @@ pub async fn test_nullable_required_param(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs index 0a44b19a32dd..471556f03bd7 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/pet_api.rs @@ -234,13 +234,14 @@ pub async fn add_pet(configuration: &configuration::Configuration, params: AddPe let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -275,13 +276,14 @@ pub async fn delete_pet(configuration: &configuration::Configuration, params: De let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -316,13 +318,14 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -357,13 +360,14 @@ pub async fn find_pets_by_tags(configuration: &configuration::Configuration, par let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -399,13 +403,14 @@ pub async fn get_pet_by_id(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -437,13 +442,14 @@ pub async fn update_pet(configuration: &configuration::Configuration, params: Up let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -484,13 +490,14 @@ pub async fn update_pet_with_form(configuration: &configuration::Configuration, let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -529,13 +536,14 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs index 67fd03a80f54..340e6f2dc97c 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/store_api.rs @@ -122,13 +122,14 @@ pub async fn delete_order(configuration: &configuration::Configuration, params: let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -163,13 +164,14 @@ pub async fn get_inventory(configuration: &configuration::Configuration) -> Resu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -197,13 +199,14 @@ pub async fn get_order_by_id(configuration: &configuration::Configuration, param let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -232,13 +235,14 @@ pub async fn place_order(configuration: &configuration::Configuration, params: P let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs index 83d1a00fb4ce..0dafccec4b72 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/testing_api.rs @@ -46,7 +46,7 @@ pub enum TestsTypeTestingGetError { } -pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result, Error> { +pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result> { let local_var_configuration = configuration; // unbox the parameters @@ -65,13 +65,11 @@ pub async fn tests_file_response_get(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; - Ok(local_var_result) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -97,13 +95,14 @@ pub async fn tests_type_testing_get(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs index 4f28c21c1cf3..985f3b65e317 100644 --- a/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-avoid-box/src/apis/user_api.rs @@ -224,13 +224,14 @@ pub async fn create_user(configuration: &configuration::Configuration, params: C let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -267,13 +268,14 @@ pub async fn create_users_with_array_input(configuration: &configuration::Config let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -310,13 +312,14 @@ pub async fn create_users_with_list_input(configuration: &configuration::Configu let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -352,13 +355,14 @@ pub async fn delete_user(configuration: &configuration::Configuration, params: D let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -386,13 +390,14 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, para let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -423,13 +428,14 @@ pub async fn login_user(configuration: &configuration::Configuration, params: Lo let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -464,13 +470,14 @@ pub async fn logout_user(configuration: &configuration::Configuration) -> Result let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -508,13 +515,14 @@ pub async fn update_user(configuration: &configuration::Configuration, params: U let local_var_resp = local_var_client.execute(local_var_req).await?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text().await?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Ok(local_var_result) } else { + let local_var_content = local_var_resp.text().await?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs index d14a0f233be3..24339cb769aa 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/fake_api.rs @@ -49,11 +49,11 @@ pub fn test_nullable_required_param(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs index c48cfb3b2f90..3bd8113f7bde 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/pet_api.rs @@ -116,11 +116,12 @@ pub fn add_pet(configuration: &configuration::Configuration, pet: models::Pet) - let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -163,11 +164,11 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -211,11 +212,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -259,11 +261,12 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -308,11 +311,12 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -353,11 +357,12 @@ pub fn update_pet(configuration: &configuration::Configuration, pet: models::Pet let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -405,11 +410,11 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -457,11 +462,12 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs index fd42617f4c7d..d1ad7c4a4fc6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/store_api.rs @@ -66,11 +66,11 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -115,11 +115,12 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -143,11 +144,12 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -172,11 +174,12 @@ pub fn place_order(configuration: &configuration::Configuration, order: models:: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs index c53219078f0e..634576260d6a 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/testing_api.rs @@ -30,7 +30,7 @@ pub enum TestsTypeTestingGetError { } -pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result> { +pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -46,11 +46,11 @@ pub fn tests_file_response_get(configuration: &configuration::Configuration, ) - let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -73,11 +73,12 @@ pub fn tests_type_testing_get(configuration: &configuration::Configuration, ) -> let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs index 0eedaddc2e48..3c186de94f98 100644 --- a/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-awsv4signature/src/apis/user_api.rs @@ -122,11 +122,11 @@ pub fn create_user(configuration: &configuration::Configuration, user: models::U let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -172,11 +172,11 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -222,11 +222,11 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -271,11 +271,11 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -299,11 +299,12 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -329,11 +330,12 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -378,11 +380,11 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -428,11 +430,11 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/fake_api.rs index d14a0f233be3..24339cb769aa 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/fake_api.rs @@ -49,11 +49,11 @@ pub fn test_nullable_required_param(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs index d7274d9986b6..b16d781edcf8 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/pet_api.rs @@ -103,11 +103,12 @@ pub fn add_pet(configuration: &configuration::Configuration, foo_pet: models::Fo let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -137,11 +138,11 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -172,11 +173,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -207,11 +209,12 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -243,11 +246,12 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -275,11 +279,12 @@ pub fn update_pet(configuration: &configuration::Configuration, foo_pet: models: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -314,11 +319,11 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -353,11 +358,12 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/store_api.rs index 2dc92a8a41b6..6bce786967c4 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/store_api.rs @@ -66,11 +66,11 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -102,11 +102,12 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -130,11 +131,12 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -159,11 +161,12 @@ pub fn place_order(configuration: &configuration::Configuration, foo_order: mode let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs index 8f42fae4014e..1b22593cdab6 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/testing_api.rs @@ -30,7 +30,7 @@ pub enum TestsTypeTestingGetError { } -pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result> { +pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -46,11 +46,11 @@ pub fn tests_file_response_get(configuration: &configuration::Configuration, ) - let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -73,11 +73,12 @@ pub fn tests_type_testing_get(configuration: &configuration::Configuration, ) -> let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/user_api.rs index 45f728426b7b..dbb0bf2ff5ff 100644 --- a/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore-model-name-prefix/src/apis/user_api.rs @@ -109,11 +109,11 @@ pub fn create_user(configuration: &configuration::Configuration, foo_user: model let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -146,11 +146,11 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -183,11 +183,11 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -219,11 +219,11 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -247,11 +247,12 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -277,11 +278,12 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -313,11 +315,11 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -350,11 +352,11 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs index d14a0f233be3..24339cb769aa 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/fake_api.rs @@ -49,11 +49,11 @@ pub fn test_nullable_required_param(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs index ebff8f8dde98..a08c09aaa3cc 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/pet_api.rs @@ -103,11 +103,12 @@ pub fn add_pet(configuration: &configuration::Configuration, pet: models::Pet) - let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -137,11 +138,11 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -172,11 +173,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -207,11 +209,12 @@ pub fn find_pets_by_tags(configuration: &configuration::Configuration, tags: Vec let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -243,11 +246,12 @@ pub fn get_pet_by_id(configuration: &configuration::Configuration, pet_id: i64) let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -275,11 +279,12 @@ pub fn update_pet(configuration: &configuration::Configuration, pet: models::Pet let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -314,11 +319,11 @@ pub fn update_pet_with_form(configuration: &configuration::Configuration, pet_id let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -353,11 +358,12 @@ pub fn upload_file(configuration: &configuration::Configuration, pet_id: i64, ad let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs index 98c889e0e55f..e62feebbf8d9 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/store_api.rs @@ -66,11 +66,11 @@ pub fn delete_order(configuration: &configuration::Configuration, order_id: &str let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -102,11 +102,12 @@ pub fn get_inventory(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -130,11 +131,12 @@ pub fn get_order_by_id(configuration: &configuration::Configuration, order_id: i let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -159,11 +161,12 @@ pub fn place_order(configuration: &configuration::Configuration, order: models:: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs index c53219078f0e..634576260d6a 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/testing_api.rs @@ -30,7 +30,7 @@ pub enum TestsTypeTestingGetError { } -pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result> { +pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; @@ -46,11 +46,11 @@ pub fn tests_file_response_get(configuration: &configuration::Configuration, ) - let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { - serde_json::from_str(&local_var_content).map_err(Error::from) + Ok(local_var_resp) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -73,11 +73,12 @@ pub fn tests_type_testing_get(configuration: &configuration::Configuration, ) -> let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) diff --git a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs index 2f328ace6051..40505efb17f2 100644 --- a/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs +++ b/samples/client/petstore/rust/reqwest/petstore/src/apis/user_api.rs @@ -109,11 +109,11 @@ pub fn create_user(configuration: &configuration::Configuration, user: models::U let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -146,11 +146,11 @@ pub fn create_users_with_array_input(configuration: &configuration::Configuratio let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -183,11 +183,11 @@ pub fn create_users_with_list_input(configuration: &configuration::Configuration let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -219,11 +219,11 @@ pub fn delete_user(configuration: &configuration::Configuration, username: &str) let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -247,11 +247,12 @@ pub fn get_user_by_name(configuration: &configuration::Configuration, username: let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -277,11 +278,12 @@ pub fn login_user(configuration: &configuration::Configuration, username: &str, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + let local_var_content = local_var_resp.text()?; serde_json::from_str(&local_var_content).map_err(Error::from) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -313,11 +315,11 @@ pub fn logout_user(configuration: &configuration::Configuration, ) -> Result<(), let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) @@ -350,11 +352,11 @@ pub fn update_user(configuration: &configuration::Configuration, username: &str, let local_var_resp = local_var_client.execute(local_var_req)?; let local_var_status = local_var_resp.status(); - let local_var_content = local_var_resp.text()?; if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { + let local_var_content = local_var_resp.text()?; let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error))