Save Response Bytes as File
First, I love this plugin and thank you for all your hard work. Second, I apologize if this was in the documentation and I missed it.
Is it possible to download a file with this plugin? Below is python code that I am using, but I would like to do this via the Rest Client if possible. Thank You!
response = requests.get(request_url,
headers = {
'Authorization': f'Bearer {access_token}'
}
)
with open(FILE_NAME, 'wb') as file:
file.write(response.content)
@Joe-Zer0 you need to preview the response first and click the Save Response and Save Response Body as you wish

@Huachao thank you for the quick response. Save Response Body does what I want. Is there some notation I can use in the .rest file to redirect the output to a file?
Also I had one more question. I am attempting to send file data as well. The examples I found use multipart/form-data. I have tried to implement this, but I just get a 500 back from the server so I am doing something incorrectly. I'm only trying to send a single file do I want to use multipart/form-data? Below is working python code of what I'm trying to accomplish in the Rest Client.
response = requests.post(request_url,
headers = {
'Authorization': f'Bearer {access_token}'
},
files = {
'': open(FILE_NAME, 'rb')
}
)
Why not have something like this?
POST https://example.com/comments/export HTTP/1.1
Content-Type: application/xml
Authorization: token xxx
> ./comments-export.xml
Folloring the "convention" of request body?
POST https://example.com/comments HTTP/1.1
Content-Type: application/xml
Authorization: token xxx
< ./demo.xml
``
I'm trying to save PDF's in a way that I can preview them using vscode-pdf plugin. This works only through ssh remote plugin when the PDF is in workspace folder. How can I set a custom default directory for storing bodies? I did not find a setting.
This feature (automatic body saving) would be very useful to monitor API response stability and evolution.
- test api, get response
> ./api-response.expected.json- add api-response.expected.json to git/SCM
Now when you run the api, any changes to api-response.expected.json get highlighted by git as changes