2
votes

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

1
It's returning a 400 so something is wrong with the request that you're sending. If the tests you have are based on a 200, those are obviously going to fail. What is the actual test and what is the actual response? Those image are a very one sided view of what's going on.Danny Dainton
If you're also using Newman V5, there has been some improvements with the way that URL encoding works in requests. There is an open issues and a workaround for certain things here github.com/postmanlabs/newman/issues/2312Danny Dainton
It was working fine previously. I compared the URL, Id and everything is same before too. Something changed in development that now its not working in newman but works fine in postmanMaddy
Did you try the workaround in the link I provided or even read it?Danny Dainton
Thanks Danny for you help. It worked. :)Maddy

1 Answers

0
votes

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()))
});