I have a GET request that retrieves a .csv file if I add '_format=csv' as query parameter on my request.
I need to assert that the generated response returns a 'Content-Length' HTTP header as well as others.
For some reason the 'Content-Length' header is NOT being generated in the headers even though the others are e.g. if I create an HTTP Header existence assertion for 'Content-Length' the assertion fails.
If I run exactly the same request in Postman - the Content-Length header is generated fine.
I'm pretty sure the problem is due to the fact that ReadyAPI! is trying to render the payload (the .csv content)
I've attached 3 images of the results - the RAW, the Outline and the XML (there is no output in the json tab).
Despite the fact that there appears to be a contentLength attribute in the Outline - if I try and assert on it or any of the 3 attributes in the Outline - I get a warning dialogue 'No match found in the current response'
If you look at the XML tab- you can see a contentLength attribute is displayed.
I know altering the prettyprint checkbox in the WSDL section does alter some of the rendering in the output (it inserts CDATA wrappers into dodgy xml) - but this isn't working.
Essentially I just need to assert the Content-Length header is present - and there's currently no way to do this in ReadyAPI that I can tell - although I can see the header in postman fine.
Is anyone very familiar with the display settings in ReadyAPI! that may help?
Thanks to all!
I'm wondering if there is a display/rendering option that I can alter - so that the
Sorry I wasn't clear - I was supplying the payload response tabs to show that the Content-Length header is being represented in some weird way via the Outline and XML tabs - but it isn't listed in the RAW (which lists headers and body). - the Content-Length header IS NOT present - despite the fact that it appears to be generated in the payload in some way.
I've embedded a screenshot of the headers below - the 'Content-Length' isn't displayed - but it is displayed if I submit the same request in Postman....???
I have - that's the point - both the developer and I are totally confused
The developer coded for the Content-Length to be a header - NOT appear in the body - and in fact it doesnt really appear in the body anyway - if you have a look at the RAW response - Content-Length isn't there.
If you submit the request via Postman or developers tools - the Content Length appears in the response headers as expected and required.
The fact that there is a contentLength attribute that appears to be returned in the Outline tab - but isnt selectable (you cant assert on it - or try and transfer the value using the OTB functionality, nor using groovy script) and the Content-Length ISN'T actually in the response body (see the RAW) - this proves that this is a case of ReadyAPI!'s rendering of the response skewing the response, because the response payload type is csv.
I was just hoping there would be some option (like the pretty print option in the WSDL settings) that I could alter cos all other tools we've tried (Postman etc.) display the Content-Length header in the headers - NOT the body - and to reiterate - if you actually look at the RAW payload - there isnt a contentLength attribute in the response payload at all....it's only in the XML translation of the payload does it insert a contentLength attribute in there.
The final proof is that if I don't submit the format=csv query parameter on the request - the request returns the Content-Length header in the header list. Its only when I add the format=csv (which forces the response payload to be returned in a csv format) that the Content-Length header is no longer included in the header list!
I'll submit a tech support call with SmartBear