Skip to content Skip to sidebar Skip to footer

Convert Response Body Blob To Json Or Plain Text In Javascript

In my cypress test, I have submitted a request and in the response the body returned as blob. How can I check the some text content in body. Is there any way convert the blob into

Solution 1:

Just check for response.body. See below example.

cy
  .request('POST', 'http://localhost:8888/users/admin', { name: 'Jane' })
  .then((response) => {
    // response.body is automatically serialized into JSONexpect(response.body).to.have.property('name', 'Jane') // true
  })

Post a Comment for "Convert Response Body Blob To Json Or Plain Text In Javascript"