Can't get response body with `context.response.getBody()` in plugin
Expected Behavior
I had wrote a local plugin to post-process response. The code as follows:
const respBody = context.response.getBody();
console.log("respBody", respBody.toString('utf-8'));
rspObj = JSON.parse(respBody.toString('utf-8'));
console.log("rspObj", rspObj);
After update insomnia version, When i send request as usual, the plugin throw a error Response hook failed SyntaxError: Unexpected token 'o', "[object Promise]" is not valid JSON
The respBody.toString('utf-8') turn to [object Promise] instead of the original response body buffer.
How can i get the original response body buffer in the new version insomnia?
Actual Behavior
The respBody.toString('utf-8') turn to [object Promise] instead of the original response body buffer.
Reproduction Steps
No response
Is there an existing issue for this?
- [x] I have searched the issue tracker for this problem.
Which sync method do you use?
- [ ] Git sync.
- [ ] Insomnia Cloud sync.
- [x] Local only
Additional Information
No response
Insomnia Version
Insomnia 11.0.1
What operating system are you using?
macOS
Operating System Version
Darwin arm64 24.0.0
Installation method
download from insomnia.rest
Last Known Working Insomnia version
No response
https://github.com/Kong/insomnia/issues/8479