form

open override fun form(formBuilder: MutableMap<String, String>.() -> Unit)

Sets the request body as form data and changes the HTTP method to POST.

Important: When called multiple times, parameters are accumulated instead of replaced. This allows you to compose form data from multiple sources or add parameters conditionally.

This method automatically:

  • Sets the HTTP method to POST

  • Sets Content-Type header to "application/x-www-form-urlencoded"

  • URL-encodes all form parameters

  • Accumulates parameters across multiple calls

Parameters

formBuilder

A lambda to build the form parameters using map syntax.

See also

For JSON POST requests.