WSRequest#queryString throws NullPointerException

Most likely related to https://github.com/playframework/playframework/issues/1159

From https://groups.google.com/d/msg/play-framework/cVRE6qf5my0/ejTPUyYhKgoJ

Hello all,

Consider this snippet:

  object CustomSigner extends SignatureCalculator {
    override def sign(request: WSRequest): Unit = {
      val queryString = request.queryString
    }
  }

  WS.url("http://www.example.com/foobar").withQueryString("zxc" -> "qwe", "asd" -> "qaz").sign(CustomSigner).get()

Trying to access queryString throws a NullPointerException. Apparently it tries to do this: (from WS.scala, around line 150)

    /**
     * Return the current query string parameters
     */
    def queryString: Map[String, Seq[String]] = {
      mapAsScalaMapConverter(request.asInstanceOf[com.ning.http.client.Request].getParams()).asScala.map(e => e._1 -> e._2.asScala.toSeq).toMap
    }

request.getParams returns null here. Apparently query parameters are set by calling addQueryParameter, but it adds into queryParams in RequestBuilderBase, not params.

Is this a bug or am I doing something wrong?

Best,

Emre
New specs about signing (Scala)