concept binary mode in category microservice

appears as: binary mode
Testing Microservices with Mountebank

This is an excerpt from Manning's book Testing Microservices with Mountebank.

If we add an octet—say 0x10—to our binary stream, the contains predicate still matches. The binary stream 0x10 0x49 0x11 encodes to “EEkR,” which clearly doesn’t contain the text “SRE=”. Had you not configured the imposter to be in binary mode, mountebank would’ve performed a simple string operation, and the predicate wouldn’t match. By switching to binary mode, you’re telling mountebank to instead decode the predicate (SRE=) to a binary array ([0x49, 0x11]) and to see if the incoming binary stream ([0x10, 0x49, 0x11]) contains those octets. It does, so the predicate matches. You can test on the command line by using the base64 utility, which ships by default with most POSIX shells (for example, Mac and Linux):