Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebService (WS) POST in Play 2.0 - Scala

When I try to pass a Map to a post, I get this error:

Cannot write an instance of scala.collection.immutable.Map[java.lang.String,java.lang.String] to HTTP response. Try to define a Writeable[scala.collection.immutable.Map[java.lang.String,java.lang.String]]

Here is my post example:

WS.url("http://mysql/endpoint")
  .post(Map("email" -> "[email protected]")).map { response =>
    Logger.logger.debug("response: " + response.body)
  }

What is happening?

like image 437
Daniel Cukier Avatar asked Dec 15 '22 15:12

Daniel Cukier


1 Answers

Here is the tips: you must send Map[String, Seq[String]]

WS.url("http://mysql/endpoint")
  .post(Map("email" -> Seq("[email protected]"))).map { response =>
    Logger.logger.debug("response: " + response.body)
  }
like image 65
Julien Lafont Avatar answered Dec 31 '22 14:12

Julien Lafont