Plain Text
By default, Diferencia expects to receive and compare JSON documents.
But if the response contains the Content-Type
header to text/plain
then the noise detection and comparison are done using text logic instead of JSON one.
If Content-Type header is not set in the response, then JSON logic is enabled by default.
|
Noise Detection
Text logic also implements a way of noise detection. The algorithm is based on substring + starts with logic.
Let’s see some examples:
primary: aaaa secondary: aa candidate: aab
Then candidate is equals to primary because the common starting part of primary and secondary is aa
.
Since candidate starts with aa
too then they are equal.
primary: aaaa secondary: aa candidate: bbb
Then candidate is not equals to primary because candidate does not start with the common part of primary and secondary.
Forcing Plain Text
If Content-Type
header is not set in the response, then JSON logic is enabled by default, but you can change this behavior by setting --forcePlainText
configuration parameter to true.
After that, if a response does not contain Content-Type
header, then text logic is enabled by default.