Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Cypress 9.6.0 - response returned from cy.request has a body as ArrayBuffer

I'd like to access response body of request sent via cy.request inside custom command, but response's body turns out to be ArrayBuffer for some weird reason, but rest of the response is just fine. Here is code example:

Cypress.Commands.add('requestWrapped', ({ method, path, body }) => {
  const token = window.sessionStorage.getItem('x-csrf')

  cy.request({
    method,
    url: `${Cypress.env('backendUrl')}/${path}`,
    body,
    headers: {
      'X-CSRF-Token': token,
      'Access-Control-Allow-Credentials': true,
      'content-type': 'application/json; charset=utf-8',
    },
  }).then((res) => {
    console.log(res.body) // ArrayBuffer here
  })
})

And it's being called inside it block

cy.requestWrapped({
  method: 'POST',
  path: 'some/random/path',
  body: {
    name: xyz,
    id: 123-123,
  },
})

I also tried to use cy.request standalone inside the test, without any wrapper around - got same result

Any ideas what might went wrong there? Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda