please pass form: true and with the payload as body rather than use FormDatacy.request({ url, method: "post", headers: { Authorization: "Basic xxx", Accept: "*/*", "Cache-Control": "no-cache", "Accept-Encoding": "gzip, deflate, br" }, form: true, body: { "xxx":"yyy" } }).then((response) => {}) I tried create a FormData object and past it as body, but didn't work. correct QueryString snippetplease pass qs with a JSON object rather than use URLSearchParamscy.request({ url, method: "post", headers: { Authorization: `Bearer ${access_token}`, }, qs: { "parametername": "parametervalue" } }); I tried create a URLSearchParams object and past it as qs, but didn't work. cy.intercept won't work if the request not send by browser or send via cy.requestthe below code will not work. the wait for the request alias will timeout with error: expect request of url but never occurred. const url = "your api" cy.intercept(url).as("yourapi"); cy.request(url); cy.wait("@yourapi"); |
Comments
Post a Comment