diff --git a/Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift b/Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift index da3c357ed44..2801ef7769a 100644 --- a/Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift +++ b/Sources/Core/AWSClientRuntime/Middlewares/AWSS3ErrorWith200StatusXMLMiddleware.swift @@ -33,10 +33,12 @@ public struct AWSS3ErrorWith200StatusXMLMiddleware: Middle return response } + response.httpResponse.body = .data(data) + let xmlString = String(data: data, encoding: .utf8) ?? "" if xmlString.contains("") { // Handle the error as a 500 Internal Server Error - var modifiedResponse = response + let modifiedResponse = response modifiedResponse.httpResponse.statusCode = .internalServerError return modifiedResponse }