Forum Discussion

NoCodeHere's avatar
NoCodeHere
New Contributor
7 years ago

HttpRequest Header Custom Parameter Variable

I have a Rest project that is based on a swagger.json file.   I have environments set up for dev, test, etc.  I need to create something like a variable that will contain an HttpRequest header parameter.  This value will be used for all requests in the suite.  What is the recommended method?  I'm able to set parameters for individual requests in external file or whatever but I don't know how to set one for the header.

 

Thanks

  • You can create suite level custom property, say NAME1, and VALU1 ( change them to your need).

    Whereever that above property is needed use property expansion i.e., ${#TestSuite#NAME1}

    Hope this is useful.

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    You can create suite level custom property, say NAME1, and VALU1 ( change them to your need).

    Whereever that above property is needed use property expansion i.e., ${#TestSuite#NAME1}

    Hope this is useful.
  • I've got a simple version of this problem which is not quite working as expected.

     

    My project is based on a wsdl.  I'm trying to invoke a simple response from the API.  I've created my custom property, AccessToken and given it a value.  

     

    Here is an example of what the provider is expecting:

     

    <HttpRequest>

        <WebHeaders>

            <AccessToken>xyz123=</AccessToken>

        </WebHeaders>

    </HttpRequest>

    <s:Envelope xmlns:s=...yadayada

     

    Yet it doesn't seem to be passing to the provider as expected.  Any suggestions?