thunderclient / thunder-client-support

Thunder Client is a lightweight Rest API Client Extension for VS Code.
https://www.thunderclient.com
Other
3.62k stars 127 forks source link

TC CLI: save response body in file #1578

Closed raShMan777 closed 1 month ago

raShMan777 commented 1 month ago

We're currently in the process of building a GitLab CI/CD pipeline for exporting data from our monitoring system and writing them into a repo. So now I discovered that the TC CLI doesn't have the feature of saving the response body to a file. While I'm capable of piping the output of tc to save the response body: Is there a way to do this in a better/cleaner way e.g. with scripting in the request?

We're using the paid version in our company.

rangav commented 1 month ago

Hi @raShMan777

can you please confirm your subscription using below form https://www.thunderclient.com/contact

rangav commented 1 month ago

You can use the below script in Tests -> Scripting tab

const fs = require('fs');

var data = tc.response.text;
console.log(data);

fs.writeFileSync("/Users/name/Downloads/response.txt", data);
raShMan777 commented 1 month ago

cool, thx. will test it on wednesday and give feedback but so far it look like an adequate solution.

raShMan777 commented 1 month ago

thx, works as expected and needed. closing this.