Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
WinHttpRequest / Microsoft.XMLDOM vs. Cypress.Request POST

I apologize in advance for this poorly worded question.

I'm re-writing an older E2E test that performs a POST of an XML document to an internal site using vbScript. With WinHttpRequest and Microsoft.XMLDOM the data is accepted and appears as expected in the website. However, when I perform the "same" operation using Cypress I obtain different results.

My question: Is there difference in the way these two technologies perform the POST operation or am I missing something in the Cypress code?

Thanks in advance for any advice!

VBS

Dim xmlhttp, oXML
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "POST", "https://InternalWebSite.com/Orders/CXMLOrder.aspx", False
xmlhttp.setRequestHeader "Content-type", "application/x-www-form-urlencoded; charset=UTF-8"
xmlhttp.setRequestHeader "Content-length", "1000"
xmlhttp.setRequestHeader "Connection", "close"
xmlhttp.setRequestHeader "soapAction", ""
Set oXML = CreateObject("Microsoft.XMLDOM")
oXML.async = False
oXML.load(localPath & "\MyOrderFile.xml")
xmlhttp.send(oXML)

CYPRESS

it('Post Order File to Site', () => {
    const myOrderFile = 'C:\\Automation\\MyOrderFile.xml'
    cy
        .readFile(myOrderFile)
        .then(function (text) {
            cy.log(text)
            postXML(text)
         })
    })

function postXML(text) {
    return cy.request({ 
        url: 'https://InternalWebSite.com/Orders/CXMLOrder.aspx',
        method: 'POST',
        body: text,
        headers: {
            'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'content-length': '1000',
            'connection': 'close',
            'soapAction': ''
        }
    }
)}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The solution ended up being quite simple.

In the original VBS code the "content-length" was set to 1000 - my assumption was that if it worked for VBS it would also work for Cypress. As it turns out setting "content-length" based on the actual XML payload length was the trick.

From: 'content-length': '1000',

To: 'content-length': text.length,

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda