public function assertResponseBodyMatches(PyStringNode $pattern) {
        $this->requireResponse();
        $pattern = (string) $pattern;

        try {
            Assertion::regex($body = (string) $this->response->getBody(), $pattern, sprintf(
                'Expected response body to match regular expression "%s", got "%s".',
                $pattern,
                $body
            ));
        } catch (AssertionFailure $e) {
            throw new AssertionFailedException($e->getMessage());
        }
    }