diff --git a/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy b/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy index 6cab8d76fd..59b4d726ee 100644 --- a/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy +++ b/accurest-core/src/main/groovy/io/codearte/accurest/util/ContentUtils.groovy @@ -51,12 +51,19 @@ class ContentUtils { return extractValueForXML(bodyAsValue, valueProvider) } catch (Exception exception) { log.debug("No content type provided and failed to parse as XML - returning the value back to the user", exception) - return bodyAsValue + return extractValueForGString(bodyAsValue, valueProvider) } } } + private static GStringImpl extractValueForGString(GString bodyAsValue, Closure valueProvider) { + return new GStringImpl( + bodyAsValue.values.collect { it instanceof DslProperty ? valueProvider(it) : it } as String[], + bodyAsValue.strings.clone() as String[] + ) + } + public static Object extractValue(GString bodyAsValue, Closure valueProvider) { return extractValue(bodyAsValue, ContentType.UNKNOWN, valueProvider) }