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.

capture the incoming header fields

Options
jimboy
jimboy Posts: 33

Is there a way to capture the incoming header data fields and store them in XML data bank. I would use them in the response.

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    Options

    To extract values from the HTTP header, it sounds like you want a Header Data Bank or REST URL Data Bank.

  • jimboy
    jimboy Posts: 33
    Options

    I don't see options to extract the first 5 characters in the header databank

  • benken_parasoft
    benken_parasoft Posts: 1,230 ✭✭✭
    edited July 2021
    Options

    The Header Data Bank tool will let you extract an entire HTTP header value (request or response).

    I don't see options to extract the first 5 characters in the header databank

    Wherever you need to use the header value, you could script that field to read the header data bank column then get the desired substring:

    def getFirstFive(def context) {
        def value = context.getValue("Generated Data Source", "columnName")
        return value.substring(0, 5)
    }
    

    Alternatively, instead of using a Header Data Bank there is also a Text Data Bank. It is a tool for extracting substrings from general text based on boundaries you define for the left and right side of the substring.