Forum Discussion
eissaeva
Contributor
Thank you for this input, Rich
From the previous answer you provided "The 'Response' bit just means the response of the specified request."
'Response' - is just a string, not a variable holding the response, correct?
nmrao
4 years agoChampion Level 3
eissaeva, 'Response' is property name that readyapi internally defines and assign value on receipt of response.
- eissaeva4 years agoContributor
Changed response header to accept application/xml in both requests and followed the instructions but this did not work
Attaching screenshot of the error and my code sample
- richie4 years agoCommunity HeroHey eissaeva,
Im sorry i think ive confused you. Im not saying change the 'Response' string in the parameter to 'Accept' to change your requests response from json to xml.
What i mean is, you dont need any groovy script at all to change it.
On the request that returns the json payload, add a header called 'Accept'
The value you need to specify on the 'Accept' header is 'application/json'. This will change the datatype of the request's response payload from json to xml.
The 'Accept' header is a standard HTTP header (that you add to a request) that allows you to change the datatype of the requests response payload.
Im probably not explaining this very well, but if you have a look at the following stackoverflow link, it will explain it.
https://stackoverflow.com/questions/35722586/header-parameters-accept-and-content-type-in-a-rest-context
Cheers,
Rich
Related Content
- 2 years ago
- 9 years ago