Forum Discussion

canpan14's avatar
canpan14
Occasional Contributor
9 years ago
Solved

Re: HTTP Request - Setting HTTP Request Body in Groovy

Hey I'm using 1.5 (Ready API). Is this the wrong forum for that? I got led here by a similar post so I thought it was the right one. 

6 Replies

  • canpan14's avatar
    canpan14
    Occasional Contributor

    I'm try to change the body of an HTTP request before I make it in groovy. The goal is that I keep making the http request using different values (pulled from a data spreatsheet) in the body to get different results. 

     

    I've tried a number of things related to:

    testRunner.testCase.testSteps["HTTP Request"].testRequest.response.responseBody    (Just an example of an attempt)

     

    But have had no luck so far either getting the body or setting the body. I did have success setting the headers before hand. The body is just giving me trouble.

     

    Thanks in advance!

    • canpan14's avatar
      canpan14
      Occasional Contributor

      IE shows the part I want to edit as the 'Request Body'

      and Chrome shows it as being Form Data (it is a form)

       

      Maybe I'm misunderstanding how it is sending it?

      • canpan14's avatar
        canpan14
        Occasional Contributor

        A friend actually helped me solve it although it was probably not the correct way to do it. 

         

        I just put a ? after the url and then input the body I wanted (like www.google.com/test?datadata) and it worked.

         

        If anyone has a cleaner solution it would still be appreciated.