swlinn
12 years agoOccasional Contributor
Request HTTP Header Order is not deterministic
I have a backend that iterates through the HTTP request headers and returns an XML response that provides the name and value of the headers received. I have an assertion that validates the XML returned is as expected. I have 5 request headers defined on my request. What I've found is that the order that SoapUI places these headers on the wire (as seen in the Raw request view as well as my backend response) varies for the last two items, and that variation is causing my assertion to fail. The headers should be presented in the order that they are defined. For example, here are some cut/paste from the Raw request view:
Headers Test 4a - THE ASSERTION PASSES
GET http://192.168.72.70:37111/request/set/simple HTTP/1.1
Accept-Encoding: gzip,deflate
Cookie: c1=blah1;c2=blah2;MyCookie2=value2;c3=blah
Cookie: c1a=blah1a
changeMe: blah
deleteMe: blah
testNumber: 4a
Host: 192.168.72.70:37111
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Note ... the order of the headers here is the way the headers are ordered on the request Headers Tab
Headers Test 4a - THE ASSERTION FAILS
GET http://192.168.72.70:37111/request/set/simple HTTP/1.1
Accept-Encoding: gzip,deflate
Cookie: c1=blah1;c2=blah2;MyCookie2=value2;c3=blah
Cookie: c1a=blah1a
changeMe: blah
testNumber: 4a
deleteMe: blah
Host: 192.168.72.70:37111
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Note that the testNumber and deleteMe headers are reversed, which causes the backend to respond with these in a different order, which causes the assertion to fail.
Regards,
Steve Linn
Headers Test 4a - THE ASSERTION PASSES
GET http://192.168.72.70:37111/request/set/simple HTTP/1.1
Accept-Encoding: gzip,deflate
Cookie: c1=blah1;c2=blah2;MyCookie2=value2;c3=blah
Cookie: c1a=blah1a
changeMe: blah
deleteMe: blah
testNumber: 4a
Host: 192.168.72.70:37111
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Note ... the order of the headers here is the way the headers are ordered on the request Headers Tab
Headers Test 4a - THE ASSERTION FAILS
GET http://192.168.72.70:37111/request/set/simple HTTP/1.1
Accept-Encoding: gzip,deflate
Cookie: c1=blah1;c2=blah2;MyCookie2=value2;c3=blah
Cookie: c1a=blah1a
changeMe: blah
testNumber: 4a
deleteMe: blah
Host: 192.168.72.70:37111
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Note that the testNumber and deleteMe headers are reversed, which causes the backend to respond with these in a different order, which causes the assertion to fail.
Regards,
Steve Linn