playframework - Forwarding in Play for Scala returns empty response -


the http forward below (futureresponse function) returns empty response browser. ideas wrong and/or should at?

  val request: wsrequest = ws.url("http://somehost/url2")   val request2: wsrequest = request.withheaders("accept" -> "application/json")   val data = json.obj(         "aaa" -> some_data1,         "bbb" -> some_data2    )    val futureresponse: future[jsvalue] = request2.post(data).map {      response =>           val json= json.obj(              "ccc" -> "111",              "ddd" -> "222"             )          json    }     ok(json) 

when message in browser, data in response empty:

enter image description here

make action asynchronous , reply future[result], like:

def someaction = action.async { implicit request =>   val request: wsrequest = ws.url("http://somehost/url2")   val request2: wsrequest = request.withheaders("accept" -> "application/json")   val data = json.obj(     "aaa" -> some_data1,     "bbb" -> some_data2   )   val futureresponse: future[jsvalue] = request2.post(data).map { response =>       val json= json.obj(          "ccc" -> "111",          "ddd" -> "222"      )       ok(json)   }    futureresponse } 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -