In request item properties, you can click button 'Build Request Body' to create request body in a user-friendly way (this feature is also supported in basic request window). It is even possible to create request body from an existing HTML data.
Build request body from an existing HTML data
HTML data can be obtained from the following sources:
- Internet address (URL).
- File on the disk.
To obtain an existing HTML data, click corresponding button in the toolbar and enter the location to extract HTML tags from.
If obtained HTML data contains FORM elements, the list will display all input elements contained inside these FORM elements.
You can also manually add additional elements to the list or remove unwanted elements from it.
For each element in the list the following options can be specified:
- Element name.
- Element value.
- URL encode; if turned on, name and value of an element will be URL encoded with the project's request encoding.
This ensures that name and value inside request body are properly URL encoded.
- Create project parameter with the specified name; if turned on, parameter will be automatically created with the specified name
and applied inside the request body for the element. For example, if there is a SELECT element with three OPTION elements, created parameter will contain
three values obtained from the 'value' attribute of those three OPTION elements.
The parameter will also automatically be set as the value for the corresponding element inside the request body.
Format of the built request body
It is possible to specify what kind of output data should be created for the response body. To specify the desired output format, select appropriate option from the drop down available in the toolbar. The following options are available:
- String with key-value pairs; this should be used for the most common HTML form submit with key-value pairs. Content type is usually 'application/x-www-form-urlencoded'.
- Multipart form data; this should be used for submitting HTML form that includes file uploads. Content type is usually 'multipart/form-data'.
- JSON object; this should be used for posting JSON object; specified element name will be used for JSON property name, specified element value will be used for JSON property value. Content type is usually 'application/json'.
- XML document; this should be used for posting XML document; specified element name will be used for XML element name, specified element value will be used for XML element value, name of the root element will be 'data'. Content type is usually 'application/xml'.
Copyright © by Borvid. All rights reserved.