JavaScript API supported by HTTP Client
console.log
The HTTP Client supports the console.log()
method to print the text value (or multiple values separated by commas) to the output of the response handler or pre-request handler scripts. You can also use client.log for the same purpose. Example:
You can also pass a JavaScript object (for example, console.log(response.body)
), and it will be displayed in the output in JSON format with proper syntax highlighting.
URLSearchParams
URLSearchParams
is a JavaScript object that makes it easy to work with the query string part of a URL. URLSearchParams
accepts parameters in the following formats:
Query string:
URLSearchParams("key=value&key2=value2");
Key-value pairs representing URL parameters:
URLSearchParams({ key1: "value1", key2: "value2" })
Array of key-value pairs:
URLSearchParams([["key1", "value1"], ["key2", "value2"]])
The HTTP Client supports all known URLSearchParams methods. Example: