USERGRID-1044: attempt #2 to preprocess response body
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/4b2d0035 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/4b2d0035 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/4b2d0035 Branch: refs/heads/master Commit: 4b2d00355e5645ab5c158b4c4f8e228037879af4 Parents: 2778f0a Author: Mike Dunker <mdun...@apigee.com> Authored: Tue Oct 27 11:29:16 2015 -0700 Committer: Mike Dunker <mdun...@apigee.com> Committed: Tue Oct 27 11:29:16 2015 -0700 ---------------------------------------------------------------------- .../usergrid/scenarios/EntityCollectionScenarios.scala | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/4b2d0035/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala index bcdb49a..f37a2d2 100644 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/EntityCollectionScenarios.scala @@ -223,15 +223,10 @@ object EntityCollectionScenarios { .transformResponse { case response if response.isReceived => new ResponseWrapper(response) { - override val body = { - val contentType = response.header("content-type").getOrElse("").toLowerCase - if (contentType.contains("json")) { - StringResponseBody(response.body.string, response.charset) - } else { - StringResponseBody("{}", StandardCharsets.UTF_8) - } - } - } + val contentType = response.header("content-type").getOrElse("").toLowerCase + val bodyStr = if (contentType.contains("json")) response.body.string else "[]" + override val body = StringResponseBody(bodyStr, response.charset) + } } // 200 for success, 400 if already exists .check(status.saveAs(SessionVarStatus), extractEntityUuid(SessionVarUuid), extractEntityModified(SessionVarModified)))