I'm trying to download a file (an image) with RestSharp using the DownloadData method
var client = new RestClient(baseUrl);
var request = new RestRequest("GetImage", Method.GET);
var response = client.DownloadData(request);
This works fine, but if the requests returns an error I cannot see the HttpStatus code.
I could make a Request and check the status:
var client = new RestClient(baseUrl);
var request = new RestRequest("GetImage", Method.GET);
var response = client.Execute(request);
var status = response.StatusCode;
But then I cannot get the image from the Content property.
I'm I missing something obvious?
The image data would be in RestResponse.RawBytes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With