[BUG APEX] Code Generation in OAS.cls
Created by: henryh-force
openapi-generator/modules/openapi-generator/src/main/resources/apex/OAS.cls
If you send a response that contains anything in addition to "application/json" nothing is returned.
Set the toReturnValue to validate for more than just application/json e.g. UTF-8 within the Content Type.
@TestVisible protected virtual Object toReturnValue(String body, Type returnType, String contentType) { Original ---> if (contentType == 'application/json') { Desired ---> if (contentType.contains('application/json')) { Object o = returnType.newInstance(); if (o instanceof MappedProperties) { Map<String, String> propertyMappings = ((MappedProperties) o).getPropertyMappings(); for (String baseName : propertyMappings.keySet()) { body = body.replaceAll('"' + baseName + '"\s*:', '"' + propertyMappings.get(baseName) + '":'); } } JsonParser parser = Json.createParser(body); parser.nextToken(); return parser.readValueAs(returnType); } return body; }