Forum Discussion

krogold's avatar
krogold
Regular Contributor
7 years ago
Solved

API not working in ReadyAPI though it works in swagger or Postman

Hello,

 

I have a problem with requests I imported from swagger.

I have a request that looks like /m2m/fim/items?filter=(tags=DEVICE)&exclude=tags,objectClass,href,operations,attributes,metadata,factory&expand=properties&limit=20

 

With swagger I can test it, if I import it in Postman, it works as well. it gives me the current request:

curl -X GET \
  'http://xx.xx.xxx.xxx/m2m/fim/items?filter=(tags%3DDEVICE)&exclude=tags%2CobjectClass%2Chref%2Coperations%2Cattributes%2Cmetadata%2Cfactory&expand=properties&limit=20' \

My SOAP request looks like

"GET /m2m/fim/items?filter=%28tags%3DDEVICE%29&exclude=tags%2CobjectClass%2Chref%2Coperations%2Cattributes%2Cmetadata%2Cfactory&expand=properties&limit=20 HTTP/1.1[\r][\n]"

 

It looks like parenthesis are converted for the request (which does not happen with Postman), then my request fails.

Can anyone tell me which syntax I can use so that the parenthesis will not be interpreted ?

 

EDIT :

I realized that I have a header, Accept-encoding, which is set to 'gzip, deflate' in my HTTP log, however in Postman, the header is Accept:application/json.

 

I can't find where to update this, do someone know this  ?

 

 

 

thank you

 

Alex

  • well, finally I executed the following groovy script :

     

                import com.eviware.soapui.support.types.StringToStringMap

                testRunner.testCase.testSuite.project.testSuites.each
                {

                    suite ->
                    suite.getValue().testCases.each
                    {
                        q1->
                        q1.getValue().testSteps.each
                        {
                            it->
                            if (it.getValue().config.type.equals("restrequest"))
                            {
                                //Get the headers of the current teststep
                                def headers = it.getValue().getHttpRequest().getRequestHeaders()
                                //log.info "headers = " + headers
                                def list = []
                                //Append the new header to the existing list
                                list.add("application/json")
                                log.info "list = " + list
                                headers["Accept"] = list;
                                //Set the updated header list
                                it.getValue().getHttpRequest().setRequestHeaders(headers)
                            }
                        }
                    }
                }  

4 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    You should be able to enable / disable compression for the requests / response thru File -> Preferences
    Once you disable, save the preferences.
    • krogold's avatar
      krogold
      Regular Contributor

      thank you but, as you can see from my Edit, my problem is more related to having the proper header in my requests.

       

      I tested on a single request and when I add the header Accept: application/json it works.

      Now my problem is to add this header to the requests in all my test cases ...