Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Saving HTTP Response Code

Options
bryancox
bryancox Posts: 15

Hi Parasoft,

I am trying to figure out how to save response HTTP code (200, 500) and added a Header Data Bank output item, but I do see anything that looks it would be for the header code. . Here is what is returned:
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
Date: Thu, 01 Nov 2018 16:22:46 GMT
Vary: Accept-Encoding
X-DOMAIN-SESSION-IDENTITY: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJlNWU4MDA5Yi1jYTMzLTQ1ZjMtODQ2NC02NjcyNGQxZWFkOTYiLCJhdWQiOiJlbnRlcnByaXNlLmNoYXJ0ZXIuY29tIiwidXNlckRhdGEiOiJ7XCJwb3J0YWxBY2NvdW50R1VJRFwiOlwiMjhhNTkwZmUtNjJmMy00YzRhLTg0OWMtZTI1MWRlOTA0OGM1XCIsXCJwb3J0YWxVc2VyR1VJRFwiOlwiZTVlODAwOWItY2EzMy00NWYzLTg0NjQtNjY3MjRkMWVhZDk2XCIsXCJlbnRpdGxlbWVudHNcIjpbXCJFWFRFUk5BTF9WSUVXXCIsXCJJTlRFUk5BTF9WSUVXXCIsXCJJTlRFUk5BTF9FRElUXCIsXCJWT0lDRV9FRElUXCIsXCJWT0lDRV9DRFJcIl0sXCJpbnRlcm5hbFVzZXJcIjpcInRydWVcIn0iLCJpc3MiOiJlbnRlcnByaXNlLmNoYXJ0ZXIuY29tIiwiZXhwIjoxNTQxNjkzOTg2LCJpYXQiOjE1NDEwODkxODYsImp0aSI6IjA1ZDYyNmE3LTgwYjktNGE3Mi05ODQ2LWRlZjY4OWVlZWY4MCJ9.PtZESdGG2LtuF1RPGjinJudwN5CUErpkq5KwYy9UjEE
X-Forwarded-For: 24.217.29.219
X-TXN-ID: 6d046518-dc87-4dee-9252-5865143eabd6
Connection: Close

It is the HTTP/1.1 value I want to save off.

Thanks in advance,

Bryan Cox

Comments

  • Thomas Moore
    Thomas Moore Posts: 82 admin
    Options

    Hi Bryan,

    To do this, I would recommend adding in a Text Data Bank to the response header. There, you can create an extraction and define the left-hand text as "HTTP/1.1 " and the right-hand text as " " (make sure you include the space character with both). Once you do so and configure the column name, you should be able to access the response code in subsequent test steps.

    Ex:

    Hope this helps!

  • bryancox
    bryancox Posts: 15
    Options

    Hey Thomas,

    That worked.

    Thanks

  • amckernon
    amckernon Posts: 4
    Options

    I have the HTTP status code in the text data bank and see it in the console but am unclear how to actually validate that I got the response code I was expecting.

  • Matt Love
    Matt Love Posts: 93 admin
    Options

    You don't need a data bank if you just want to validate the response code you were expecting.
    Simply configure the Valid HTTP Response Codes field in the Misc tab of your REST Client or Messaging Client.