ws » put(url,body,var)
Description
This command sends a HTTP PUT request to the given url
with the given request body
. The
response is captured and stored as var
.
To learn about how to utilize the response returned from the target URL, click here.
Expressing body
as file content
Note that this command support automatic content resolution via:
- Fully qualified file path, or
- URL (GET only)
- When the
body
parameter contains a valid URL, Nexial’s default behavior is to treat it as is(meaning, Nexial won’t resolve its content). One can instruct Nexial to automatically resolve the underlying content by setting thenexial.resolveTextAsURL
totrue
.
- When the
When body
is specified as a fully qualified file path or a valid URL, Nexial will attempt to extract the corresponding
file content as the request payload. Such content can be resolved as text or binary content depending on the
Content-Type
header defined (via head(url,var)
) prior to the execution of this command.
Alternatively, one can enforce Nexial to treat the corresponding file content as binary via the
nexial.ws.requestPayloadAsRaw
System variable.
In addition, if the corresponding file content is to be treated as text, the following System variables may have some impact as well:
nexial.resolveTextAsIs
- to omit automatic data variable substitutionnexial.ws.requestPayloadCompact
- to trim off leading/trailing spaces from content
Parameters
- url - the target URL
- body - the payload to send, or
(empty)
if none is to be send - var - the variable to hold the response