reqwest.form
reqwest.form
Function
Set application/x-www-form-urlencoded form request body.
Syntax
reqwest(url).form(values)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| values | Object | No | None | Form field mapping object; rules for keys and values are below. |
values object structure
| key | value type | description |
|---|---|---|
| Form field name | Any | The field value to be written into the application/x-www-form-urlencoded request body; it will be converted to a string when called. |
Return value
| Type | Description |
|---|---|
| Reqwest | Returns the new request builder. |
Example
// Send the form field name=BT. request = reqwest('https://example.com').method('POST').form({name: 'BT'}) result = type(request) // Output: Reqwest print result
Notes
- values must be objects, otherwise an error will be reported.
- Body, json, form, and multipart will all set the request body; the last request body set in the same request will take effect.