Daniel Cukier
Daniel Cukier

Reputation: 11942

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?

Upvotes: 4

Views: 1994

Answers (1)

Julien Lafont
Julien Lafont

Reputation: 7877

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)
  }

Upvotes: 12

Related Questions