1

I use kohttp to send requests to my service, but I got stuck.

Lets imagine that we have a function, that creates a request with some parameters that are represented as Map, and also append to them one or more additional param.

override fun request(urlString: String, params: Map<String, Any>?): Response {

    val response = httpGet {
        url = urlString
        param {
            "someName" to someValue
            // also add 'params' map to request parameters
        }
    }
    return  response;
}

How can we do so?

1 Answers1

1

I guess this should work:

param {
    "someName" to someValue
     params?.forEach { key, value ->
        key to value
    }
}
JB Nizet
  • 678,734
  • 91
  • 1,224
  • 1,255