Forum Discussion
oph_2022
Occasional Contributor
Hey Ritchie,
Thanks for your reply.
My json response is not contained within an array.
My JSON response is contained (Sequence Dispatch Style) here and i would like to know if i put the groovy code that you provied in your previous message can work here ?
Thanks,
Olivier,
richie
3 years agoCommunity Hero
Hey oph_2022,
Just to be clear, json arrays are represented by square brackets. All your payload content is contained within the square brackets, which means the whole content is saved within an array.
Youre using virts for your testing, right? Sorry i didn't realise this from your initial message. I've only used readyapi virts a couple of times, but yeah you can tailor your response with a script, but i must be misunderstanding something essential here, cos i dont understand why youd need to alter the hardcoded response via an event handler as you can specify exactly the response you want, without the need for an event handler as a post-processor before you assert.
Can you just explain your setup and use case a little more as i dont want to give you more incorrect info?
As you control in thr virt exactly the response youre trying to generate, what happens when you remove the array container brackets (both the [ and ])??
Cheers,
Rich
Just to be clear, json arrays are represented by square brackets. All your payload content is contained within the square brackets, which means the whole content is saved within an array.
Youre using virts for your testing, right? Sorry i didn't realise this from your initial message. I've only used readyapi virts a couple of times, but yeah you can tailor your response with a script, but i must be misunderstanding something essential here, cos i dont understand why youd need to alter the hardcoded response via an event handler as you can specify exactly the response you want, without the need for an event handler as a post-processor before you assert.
Can you just explain your setup and use case a little more as i dont want to give you more incorrect info?
As you control in thr virt exactly the response youre trying to generate, what happens when you remove the array container brackets (both the [ and ])??
Cheers,
Rich
Related Content
- 7 years ago
- 8 years ago
Recent Discussions
- 5 days ago
- 10 days ago