Forum Discussion

AAB's avatar
AAB
Regular Contributor
3 years ago
Solved

ReadyAPI: how to add custom headers at Project level?

HI,

 

Is there a possibility to put headers on Project level please? So that each testcase in all tessuites pick up these headers?

I've been looking arround on community, but this    https://community.smartbear.com/t5/API-Functional-Security-Testing/How-to-add-custom-headers-at-parent-level/td-p/165007

doesn't work for me. The headers aren't in the request. Is there any possibility to do this please?

 

Thanks in advance!

Bill_In_Irvine    nmrao HimanshuTayal   richie  ?

 

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    AAB 

    Would you please clarify

    - what headers and their respective values needed?

    - what type of test steps that is required? In general, SOAP, HTTP, REST Requests.

    - what is happening when you tried the solution you have pointed?

     

    In general Events is the way when something needs to be done to all / conditional outgoing or inbound requests or responses.

    Apart from RequestFilter, one can also use SubmitListener.beforeSubmit; but the methods have different inputs. It is possible to achieve though.

  • AAB's avatar
    AAB
    Regular Contributor

    nmrao thanks for your question and explanation!

    The purpose is actually to put in each of the teststep the same header:

    iv-user: 1111
    
    iv-group: aaaaa
    
    accept:  */*

     

     

     

    But I found the solution here:

    https://community.smartbear.com/t5/API-Functional-Security-Testing/RequestFilter-filterRequest-Script-applied-to-only-specific-Test/td-p/156599

     

    Actually, I've forgotten too declare the headers. 

    Missing line:

    def headers = request.requestHeaders

     

    My bad! ğŸ˜ž 

     

    Kind regards,

    AAB

    • nmrao's avatar
      nmrao
      Champion Level 3
      Glad to know you found the issue and proceeded.