我希望在柏树路线方法中获取req对象。通过这样做,我可以决定用户在使用具有动态响应的graphql路由时返回的内容。有没有人能够完成这个?
我认为有权访问这将是非常有用的。
我希望这有帮助,xhr.requestBody
帮助访问请求正文,
cy.route("GET", "/login").as("getLogin");
cy.get("#contactID").type("[email protected]");
cy.contains("Login").click();
cy.wait("@getLogin").then(function(xhr) {
// we can now access the low level xhr
// that contains the request body,
// response body, status, etc
const request = xhr.requestBody;
expect(response[0]).to.have.property("SomeKey", "Data");
const response = xhr.responseBody;
expect(response[0]).to.have.property("LineName", "Line A");
});