diff --git a/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache index c2e9eb5be477..9afb8828d555 100644 --- a/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/r/ApiResponse.mustache @@ -38,6 +38,23 @@ ApiResponse <- R6::R6Class( self$status_code <- status_code self$status_code_desc <- status_code_desc self$headers <- headers + }, + + #' Return the response as text + #' + #' @description + #' The response is stored as a raw vector. Use this to access the response after + #' converting it to text. If the response is not coercible to text NA is returned. + #' + #' @param from_encoding The encoding of the raw response. + #' @param to_encoding The target encoding of the return value. + #' @export + response_as_text = function(from_encoding = NULL, to_encoding = "UTF-8") { + text_response <- iconv(readBin(self$response, character()), from = from_encoding, to = to_encoding) + if (is.na(text_response)) { + warning("The response is binary and will not be converted to text.") + } + return(text_response) } ) ) diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 46067f6d5280..e81cd16951d3 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -637,7 +637,7 @@ } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "{{returnType}}", loadNamespace("{{packageName}}")), + self$api_client$deserialize(local_var_resp$response_as_text(), "{{returnType}}", loadNamespace("{{packageName}}")), error = function(e) { {{#useDefaultExceptionHandling}} stop("Failed to deserialize response") diff --git a/modules/openapi-generator/src/main/resources/r/api_client.mustache b/modules/openapi-generator/src/main/resources/r/api_client.mustache index 9530234c8c49..3057ea2c4004 100644 --- a/modules/openapi-generator/src/main/resources/r/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/r/api_client.mustache @@ -318,7 +318,7 @@ ApiClient <- R6::R6Class( api_response <- ApiResponse$new() api_response$status_code <- httr::status_code(httr_response) api_response$status_code_desc <- httr::http_status(httr_response)$reason - api_response$response <- httr::content(httr_response, "text", encoding = "UTF-8") + api_response$response <- httr::content(httr_response, "raw") api_response$headers <- httr::headers(httr_response) api_response diff --git a/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache b/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache index decfe50f1d05..54148bca6533 100644 --- a/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache @@ -323,7 +323,7 @@ ApiClient <- R6::R6Class( api_response <- ApiResponse$new() api_response$status_code <- resp %>% resp_status() api_response$status_code_desc <- resp %>% resp_status_desc() - api_response$response <- resp %>% resp_body_string() + api_response$response <- resp %>% resp_body_raw() api_response$headers <- resp %>% resp_headers() api_response diff --git a/samples/client/petstore/R-httr2-wrapper/R/api_client.R b/samples/client/petstore/R-httr2-wrapper/R/api_client.R index 5ad09ce50e02..5e51a57b302b 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/api_client.R +++ b/samples/client/petstore/R-httr2-wrapper/R/api_client.R @@ -312,7 +312,7 @@ ApiClient <- R6::R6Class( api_response <- ApiResponse$new() api_response$status_code <- resp %>% resp_status() api_response$status_code_desc <- resp %>% resp_status_desc() - api_response$response <- resp %>% resp_body_string() + api_response$response <- resp %>% resp_body_raw() api_response$headers <- resp %>% resp_headers() api_response diff --git a/samples/client/petstore/R-httr2-wrapper/R/api_response.R b/samples/client/petstore/R-httr2-wrapper/R/api_response.R index 6cff851aed42..f76d20d3f769 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/api_response.R +++ b/samples/client/petstore/R-httr2-wrapper/R/api_response.R @@ -44,6 +44,23 @@ ApiResponse <- R6::R6Class( self$status_code <- status_code self$status_code_desc <- status_code_desc self$headers <- headers + }, + + #' Return the response as text + #' + #' @description + #' The response is stored as a raw vector. Use this to access the response after + #' converting it to text. If the response is not coercible to text NA is returned. + #' + #' @param from_encoding The encoding of the raw response. + #' @param to_encoding The target encoding of the return value. + #' @export + response_as_text = function(from_encoding = NULL, to_encoding = "UTF-8") { + text_response <- iconv(readBin(self$response, character()), from = from_encoding, to = to_encoding) + if (is.na(text_response)) { + warning("The response is binary and will not be converted to text.") + } + return(text_response) } ) ) diff --git a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R index 3a3ccd3d7a13..747da5d45c30 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/fake_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/fake_api.R @@ -365,7 +365,7 @@ FakeApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -485,7 +485,7 @@ FakeApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "User", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "User", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2-wrapper/R/pet_api.R b/samples/client/petstore/R-httr2-wrapper/R/pet_api.R index c860003e125a..054a8c18952e 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/pet_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/pet_api.R @@ -746,7 +746,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -984,7 +984,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "array[Pet]", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "array[Pet]", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1100,7 +1100,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "array[Pet]", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "array[Pet]", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1221,7 +1221,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1353,7 +1353,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1483,7 +1483,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1605,7 +1605,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1843,7 +1843,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "ModelApiResponse", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "ModelApiResponse", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2-wrapper/R/store_api.R b/samples/client/petstore/R-httr2-wrapper/R/store_api.R index d5238552acfe..7e731571d644 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/store_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/store_api.R @@ -438,7 +438,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "map(integer)", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "map(integer)", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -567,7 +567,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Order", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Order", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -686,7 +686,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Order", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Order", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2-wrapper/R/user_api.R b/samples/client/petstore/R-httr2-wrapper/R/user_api.R index f047afe243db..c72516848343 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/user_api.R +++ b/samples/client/petstore/R-httr2-wrapper/R/user_api.R @@ -970,7 +970,7 @@ UserApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "User", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "User", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1103,7 +1103,7 @@ UserApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "character", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2/R/api_client.R b/samples/client/petstore/R-httr2/R/api_client.R index 5ad09ce50e02..5e51a57b302b 100644 --- a/samples/client/petstore/R-httr2/R/api_client.R +++ b/samples/client/petstore/R-httr2/R/api_client.R @@ -312,7 +312,7 @@ ApiClient <- R6::R6Class( api_response <- ApiResponse$new() api_response$status_code <- resp %>% resp_status() api_response$status_code_desc <- resp %>% resp_status_desc() - api_response$response <- resp %>% resp_body_string() + api_response$response <- resp %>% resp_body_raw() api_response$headers <- resp %>% resp_headers() api_response diff --git a/samples/client/petstore/R-httr2/R/api_response.R b/samples/client/petstore/R-httr2/R/api_response.R index 6cff851aed42..f76d20d3f769 100644 --- a/samples/client/petstore/R-httr2/R/api_response.R +++ b/samples/client/petstore/R-httr2/R/api_response.R @@ -44,6 +44,23 @@ ApiResponse <- R6::R6Class( self$status_code <- status_code self$status_code_desc <- status_code_desc self$headers <- headers + }, + + #' Return the response as text + #' + #' @description + #' The response is stored as a raw vector. Use this to access the response after + #' converting it to text. If the response is not coercible to text NA is returned. + #' + #' @param from_encoding The encoding of the raw response. + #' @param to_encoding The target encoding of the return value. + #' @export + response_as_text = function(from_encoding = NULL, to_encoding = "UTF-8") { + text_response <- iconv(readBin(self$response, character()), from = from_encoding, to = to_encoding) + if (is.na(text_response)) { + warning("The response is binary and will not be converted to text.") + } + return(text_response) } ) ) diff --git a/samples/client/petstore/R-httr2/R/fake_api.R b/samples/client/petstore/R-httr2/R/fake_api.R index c0c1324e56b8..40acaae69d2e 100644 --- a/samples/client/petstore/R-httr2/R/fake_api.R +++ b/samples/client/petstore/R-httr2/R/fake_api.R @@ -365,7 +365,7 @@ FakeApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -485,7 +485,7 @@ FakeApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "User", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "User", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2/R/pet_api.R b/samples/client/petstore/R-httr2/R/pet_api.R index 77d3de452190..9bc403759fdf 100644 --- a/samples/client/petstore/R-httr2/R/pet_api.R +++ b/samples/client/petstore/R-httr2/R/pet_api.R @@ -746,7 +746,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -984,7 +984,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "array[Pet]", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "array[Pet]", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1100,7 +1100,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "array[Pet]", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "array[Pet]", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1221,7 +1221,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1353,7 +1353,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1483,7 +1483,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1605,7 +1605,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1843,7 +1843,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "ModelApiResponse", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "ModelApiResponse", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2/R/store_api.R b/samples/client/petstore/R-httr2/R/store_api.R index 60b60fa0603b..b247ecb44c05 100644 --- a/samples/client/petstore/R-httr2/R/store_api.R +++ b/samples/client/petstore/R-httr2/R/store_api.R @@ -438,7 +438,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "map(integer)", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "map(integer)", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -567,7 +567,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Order", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Order", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -686,7 +686,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Order", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Order", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R-httr2/R/user_api.R b/samples/client/petstore/R-httr2/R/user_api.R index 50c752bd7e6a..3af17151a7ce 100644 --- a/samples/client/petstore/R-httr2/R/user_api.R +++ b/samples/client/petstore/R-httr2/R/user_api.R @@ -970,7 +970,7 @@ UserApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "User", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "User", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1103,7 +1103,7 @@ UserApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "character", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R/R/api_client.R b/samples/client/petstore/R/R/api_client.R index 6fe5c3488f1b..2fa06773f021 100644 --- a/samples/client/petstore/R/R/api_client.R +++ b/samples/client/petstore/R/R/api_client.R @@ -299,7 +299,7 @@ ApiClient <- R6::R6Class( api_response <- ApiResponse$new() api_response$status_code <- httr::status_code(httr_response) api_response$status_code_desc <- httr::http_status(httr_response)$reason - api_response$response <- httr::content(httr_response, "text", encoding = "UTF-8") + api_response$response <- httr::content(httr_response, "raw") api_response$headers <- httr::headers(httr_response) api_response diff --git a/samples/client/petstore/R/R/api_response.R b/samples/client/petstore/R/R/api_response.R index 6cff851aed42..f76d20d3f769 100644 --- a/samples/client/petstore/R/R/api_response.R +++ b/samples/client/petstore/R/R/api_response.R @@ -44,6 +44,23 @@ ApiResponse <- R6::R6Class( self$status_code <- status_code self$status_code_desc <- status_code_desc self$headers <- headers + }, + + #' Return the response as text + #' + #' @description + #' The response is stored as a raw vector. Use this to access the response after + #' converting it to text. If the response is not coercible to text NA is returned. + #' + #' @param from_encoding The encoding of the raw response. + #' @param to_encoding The target encoding of the return value. + #' @export + response_as_text = function(from_encoding = NULL, to_encoding = "UTF-8") { + text_response <- iconv(readBin(self$response, character()), from = from_encoding, to = to_encoding) + if (is.na(text_response)) { + warning("The response is binary and will not be converted to text.") + } + return(text_response) } ) ) diff --git a/samples/client/petstore/R/R/fake_api.R b/samples/client/petstore/R/R/fake_api.R index dd909ca79ad3..78f339f559bc 100644 --- a/samples/client/petstore/R/R/fake_api.R +++ b/samples/client/petstore/R/R/fake_api.R @@ -365,7 +365,7 @@ FakeApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -485,7 +485,7 @@ FakeApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "User", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "User", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index e407d3c708c5..361d74d4c38c 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -746,7 +746,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -984,7 +984,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "array[Pet]", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "array[Pet]", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1100,7 +1100,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "array[Pet]", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "array[Pet]", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1221,7 +1221,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1353,7 +1353,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1483,7 +1483,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1605,7 +1605,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Pet", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Pet", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1843,7 +1843,7 @@ PetApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "ModelApiResponse", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "ModelApiResponse", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R/R/store_api.R b/samples/client/petstore/R/R/store_api.R index 20eb0cd2cd42..e4f4293263de 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -438,7 +438,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "map(integer)", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "map(integer)", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -567,7 +567,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Order", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Order", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -686,7 +686,7 @@ StoreApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "Order", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "Order", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 0f0243a7b681..e62036afca2a 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -970,7 +970,7 @@ UserApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "User", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "User", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", @@ -1103,7 +1103,7 @@ UserApi <- R6::R6Class( } deserialized_resp_obj <- tryCatch( - self$api_client$deserialize(local_var_resp$response, "character", loadNamespace("petstore")), + self$api_client$deserialize(local_var_resp$response_as_text(), "character", loadNamespace("petstore")), error = function(e) { rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException",