Field Map
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
Content copied to clipboard
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
Content copied to clipboard