rq.response object provides access to all details of the API response in your Requestly scripts. You can use these properties and methods primarily in post-response scripts to process, validate, and extract data from API responses.
Properties and Methods
rq.response.body
The body of the response as a string.
Example:
rq.response.bodyEncoding
Tells you how rq.response.body encodes the original response bytes:
'utf8'- the body is the decoded text. This is the case for JSON, XML, HTML, and other text responses.'base64'- the body is Base64-encoded raw bytes, used for binary responses such as images, PDFs, and archives.
'utf8'.
Example:
rq.response.responseTime
The time taken by the request to complete, in milliseconds.
Example:
rq.response.headers
An list of header rows each having key, value for each custom header you create.
Example:

