Forum Discussion

TerryHe's avatar
TerryHe
New Contributor
8 years ago

Post: How to replace the variables in attachment

I defined following in groovy script

=============

vars["sg"] = "sg1"
context.vars = vars

=============

 

If the POST request is "application/xml", i can use "${=vars.sg}" to access the real value.

 

While if the POST request is an attachment file with "mustipart/form-data", the value did not get replaced!!

===========================
<SessionGroup>${=vars.sg}</SessionGroup>

===========================

 

How can i replace the value in the attachment file

3 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

     

    Hi Terryhe,

     

     

    Do you want to replace value inside the attached file? If you do, I don't think this is possible to do. If I misunderstood your task, please clarify it.

    • TerryHe's avatar
      TerryHe
      New Contributor

      Hi Tanya Gorbunova,

       

      You are right, the file content would contain the variables and i want to replace it.

       

      If this is not supported, i think the only way is to use something else like "groovy" to generate the request and send it, right?

       

      Thanks!

      Terry

  • nmrao's avatar
    nmrao
    Champion Level 3
    If it is the case, you may have modify the file content and save the file prior to send the request.