`formParameters` doesn't work
cc @stacycurl
I have to construct the query params my self, if I use formParameters on a request it doesn't seem to work (I get 404).
def get(uri: String, params: Map[String, String]): Future[Response] = {
val formParams: List[FormParameter] = params.map(kv => FormParameter(kv._1, kv._2)).toList
val paramSuffix: String = if (params.isEmpty) "" else s"?${params.map(kv => kv._1 + "=" + kv._2).mkString("&")}"
Future {
// Works
http(
GET(uri + paramSuffix)
)
// Not work
http(
GET(uri)
.formParameters(formParams: _*),
)
}
}
Also FormParameter seems like a fairly redundant type, could just use Map[String, String]
@samthebest I'd be happy to pair with you to explore this.
FormParameter is part of naive-http's domain (although not as central as Request, Response, etc), Map[String, String] is not.
Map[String, String] may very well be a fine underlying encoding, it's a terrible representation/api as it has nothing to do with form parameters. The domain of http deserves to be first class (especially in a library about http !), whilst also being careful not to gatekeep / be rigid / drown in NIH.