# Response Processor

This feature is only available in the vREST NG Pro Edition. If you want to pre-process the API response before the validation of your test case then vREST provides some built-in response processors and also allow you to write your own custom response processor by using the utility methods.

First, we will see the builtin response processors and then we will look at how you may write a custom response processor.

vREST provides the following builtin response processors:

# base64

This response processor converts the API response into a base64 string. This processor might be useful in validating the binary responses by their base64 equivalent.

# blank

This response processor always returns blank string irrespective of the API response. It is useful in ignoring a large binary/textual response.

# checksum

This response processor converts the API response into a md5 hash string. This processor is also useful in validating the binary responses by their checksum.

# csv2json

If the API response is CSV content then this response processor converts that CSV content into JSON format.

# xml2json

If the API respone is XML content then this response processor converts that XML content into JSON format. This makes validing the XML responses a lot more easier.

# xls2json

If the API response is an XLS file then this response processor converts that XLS file into JSON format for further validation.

# Custom Response Processor

You may even write a custom response processor. Let's take a practical example to understand its utility. Suppose your server returns a JSON response but in base64 encoded format. So, in this situation, you may write a custom utility method that will decode the API response first and you may easily validate your API response after that.

Suppose our sample API returns the following encoded API response as shown in the screenshot. For the demonstration purposes, the JSON response is only base64 encoded.

Now lets write a custom utility method, which decodes this base64 encoded string into JSON content again. We have specified the utility method named as decodeBase64 as shown below:

Let's use this utility method in our test case to decode the API response. Just specifiy the utility method name in the Response Processor field. You can see that now vREST is showing the actual response as JSON string. Which you may easily validate using JSON response validation.