griffon vulture
griffon vulture

Reputation: 6774

scala spray get long list of parameters

I have an application written on scala/spray, and a GET function that need to receive a long list of parameters (30+).

what is the best way to receive them in route as an hashMap or object?

Upvotes: 1

Views: 139

Answers (1)

jack
jack

Reputation: 126

Use parameterMap

example:

parameterMap { params =>
    def paramString(param: (String, String)): String = s"""${param._1} = '${param._2}'"""
    complete(s"The parameters are ${params.map(paramString).mkString(", ")}")
  }

Upvotes: 2

Related Questions