我正在尝试获取请求的POST数据,并将其与预期的数据字符串进行比较,但它不起作用,不确定这里出了什么问题:
var PostData = '"{\\\"filter\\\":{\\\"operator\\\":\\\"and\\\"}}"';
expect(PostData).toMatch(JSON.stringify(message.params.request.postData));
我的期望每次都会因以下错误而失败:
Expected '"{\"filter\":{\"operator\":\"and\"}}"' to match '"{\"filter\":{\"operator\":\"and\"}}"'
expect(PostData).toMatch(JSON.stringify(JSON.parse(message.params.request.postData)));