form method
Set request body as URL-encoded form data.
Automatically encodes the form data and sets the appropriate Content-Type header. Values are URL-encoded to handle special characters.
Example:
testApp.post('/api/login')
.form({
'username': 'user@example.com',
'password': 'secret123',
'remember_me': 'true',
});
data Form field names and values.
Returns this request builder for method chaining.
Implementation
TestRequest form(Map<String, String> data) {
_body = data;
_contentType = 'application/x-www-form-urlencoded';
return this;
}