To view or change properties and contents of virtual responses, select a response in the Outgoing column of the Setup page of the virtual service editor. You will see the properties on the right of the ReadyAPI window:
Properties of REST responses are organized into the following categories.
|Http Status Code||
The response status line and code.
|Content | Media type||Specifies the data type of the response body.|
The Editor box contains the response body data. You can include custom properties of your virtual service, as well as data source properties, into the response. To do this, use syntax like this:
The Outline view is available if the Editor contains XML data.
A Groovy script code that the virtual service runs before sending the response to the client. You can use this code, for example, to change the response contents or for debug purposes. For information on scripting and available objects, see Virtual Service Scripting.
Note that methods and properties of the
mockResponse object modify the response body that you have in the Editor box.
A list of custom response headers. The toolbar above the list contains commands for creating and deleting headers, changing their order, sorting, clearing header values, and loading header values from and saving them to a file.
In custom headers, you can mention custom properties of your service and data source properties, for example:
Specifies the data source, whose properties you can use in the response body and headers. See Data Sources in Virtual Services.
If the response body contains a JSON object, you can create data source properties from the object properties. To do this, simply click .