FieldMap

annotation class FieldMap(val encoded: Boolean = false)

Named key/value pairs for a form-encoded request.

Needs to be used in combination with @FormUrlEncoded

@POST
@FormUrlEncoded
suspend fun example(@FieldMap things: Map<String, String>): Response

example(mapOf("name" to "Bob Smith", "position" to "President"))
// Generate name=Bob+Smith&position=President

Pair / vararg example:

@POST
@FormUrlEncoded
suspend fun example(@FieldMap vararg fullNames: Pair<String, String>): Response

example("first_name" to "Bob", "last_name" to "Smith", "alias" to "Jane Doe")
// Generate first_name=Bob&last_name=Smith&alias=Jane+Doe

See also

Properties

Link copied to clipboard
val encoded: Boolean = false

Specifies whether the names and values are already URL encoded.