Skip to content

Commit

Permalink
this is closer to a proper response
Browse files Browse the repository at this point in the history
  • Loading branch information
chad committed Jan 13, 2013
1 parent 63e4b0e commit 0c60221
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/controllers/Batch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import play.api.libs.json._
import play.api.libs.ws._
import models.Operation
import models.BatchRequest
import models.BatchResponse
import models.BatchResult

object Batch extends Controller {
trait WSResult
Expand Down Expand Up @@ -36,11 +38,11 @@ object Batch extends Controller {

if( batchRequest.sequential ) new SyncResult(response.value.get) else new AsyncResult(response)
}
val body = responses.map {
case SyncResult(result) => result.body
case AsyncResult(result) => result.value.get.body
}.mkString("\n")
Ok(body)
val batchResponse = new BatchResponse(responses.map {
case SyncResult(result) => BatchResult(result.status, result.body, Map("FIXME" -> "This is hard-coded"))
case AsyncResult(result) => BatchResult(result.value.get.status, result.value.get.body, Map("FIXME" -> "This is hard-coded"))
})
Ok(batchResponse.asJson)
}


Expand Down

0 comments on commit 0c60221

Please sign in to comment.