Fixed body parsing - support for lists

This commit is contained in:
Jakub Kubrynski
2015-02-21 14:14:45 +01:00
parent 614f5438a8
commit bb360c95e9

View File

@@ -33,13 +33,13 @@ class Body {
this.bodyAsValue = new DslProperty(getClientValue(bodyAsValue), getServerValue(bodyAsValue))
}
private Map getClientValue(GString bodyAsValue) {
private def getClientValue(GString bodyAsValue) {
GString clientGString = new GStringImpl(bodyAsValue.values.clone(), bodyAsValue.strings.clone())
Object[] clientValues = bodyAsValue.values.collect { it instanceof DslProperty ? it.clientValue : it } as Object[]
return new JsonSlurper().parseText(new GStringImpl(clientValues, clientGString.strings).toString())
}
private Map getServerValue(GString bodyAsValue) {
private def getServerValue(GString bodyAsValue) {
GString clientGString = new GStringImpl(bodyAsValue.values.clone(), bodyAsValue.strings.clone())
Object[] serverValues = bodyAsValue.values.collect { it instanceof DslProperty ? it.serverValue : it } as Object[]
return new JsonSlurper().parseText(new GStringImpl(serverValues, clientGString.strings).toString())