Search code examples
jenkins-pipelinenewman

Test script is failing when executed via Newman in Jenkins while works fine in postman and no postman console error comes


Getting below error when execute tests via Newman - Jenkins. The same request works fine via postman.

HTTP request parsing failed with error: "Malformed URI: /v1/addresses?country=AUS&id=AUG|5f246f9b-7c97-4233-8de7-2d57f74cd86b|7.7305OAUGGwvjBwAAAAAIAgEAAAAAB7zTAAAAAAAAADEAAP..ZAAAAAD.....AAAAAAAAAAAAAAAAAAAAMTc3IHBhY2lmaWMgaHd5AAAAAAA-$15"

Newman Report:

enter image description here

Jenkins console output: enter image description here

Postman Screenshot The same test passes in Postman while when executed via newman this fails. Please note it was working fine till 2 days back but after new deployment this doesn't work anymore. enter image description here


Solution

  • Add below code in pre-request script and it worked in Newman as well.

    pm.request.url.query.each((q) => {
         q.update(encodeURI(q.toString()))
    });