Contributions
Re: In ServiceV, how do I return a scripted response without it being overwritten in the Editor?
I used a workaround. I placed the Response in the 'Script' tab. I moved the Groovy code to compress it into an external groovy function. Then, I packaged the response and set it to the mockResponse. For example.. String response= """ <Start> ... <Compress>abcdefg</Compress> <SomeOtherStuff/> </Start> """ def newResponse = Utility.compress(response) context.mockResponse.setResponseContent(newResponse) This way, I can see the full Response. The Utility.compress function that I wrote, willleave everything as is, and just compress what needs to be compressed.Hope this helps7 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.4KViews1like0CommentsIn ServiceV, how do I return a scripted response without it being overwritten in the Editor?
Hello, In one of my Virts, I have a Response typed out in XML in the Editor. I am using the "Script" tab to make Gzip and Base64 the message, as this is what our service expects. The script looks like this: def targetStream = new ByteArrayOutputStream() def zipStream = new GZIPOutputStream(targetStream) def data = mockResponse.getResponseContent().toString() zipStream.write(data.getBytes()) zipStream.close() def zipped = targetStream.toByteArray() targetStream.close() mockResponse.setResponseContent(zipped.encodeBase64()) This code "works" because it sends back the message as I expect. However, it has the side effect of changing the content of the Editor from XML to the encoded/GZipped message. Is there a way to do this so that it does not overwrite what is in the Editor. i.e. It would be beneficial to be able to see the message in plaintext. Thanks in advance.2.2KViews1like2Comments