Forum Discussion

richie's avatar
richie
Community Hero
6 years ago

Weird Results - Content-Length Header is NOT appearing but is generated in Postman

Hi,

 

I have a GET request that retrieves a .csv file if I add '_format=csv' as  query parameter on my request.

 

e.g.

 

/api/1/{namespace}/{dataset}?_format=csv

 

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!

 

richie

 

 

I'm wondering if there is a display/rendering option that I can alter - so that the 

  • nmrao's avatar
    nmrao
    Champion Level 3
    richie,
    The images are from the response. However, you like to verify the headers, right? Please check the headers tab for the response.
    • richie's avatar
      richie
      Community Hero

      Hey nmrao 

       

      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....???

       

       

       

      Cheers!

       

      richie

      • nmrao's avatar
        nmrao
        Champion Level 3
        From your posts, content length is part of response, but does not seem to be part of headers. If that is expected in the headers, then check with your team.