Closed
Description
Issue Summary
When I try to send an email without network connection to remote SMTP server, a response contains 200 OK
in StatusCode
and HttpRequestException
in Body
. I think it denies basic HTTP principles and such behaviour is completely unclear. I propose to throw a real exception. If impossible, the code from 4xx-5xx range should be used.
Steps to Reproduce
var sg = new SendGridAPIClient("my_api_key");
Mail mail = new Mail(from, subject, to, content);
//disconnect from Internet before executing this line
var response = await sg.client.mail.send.post(requestBody: mail.Get());
//writes "OK"
Console.WriteLine(response.StatusCode);
//writes ".NET HttpRequestException, raw message: An error occurred while sending the request"
Console.WriteLine(response.Body.ReadAsStringAsync().Result);
Technical details:
- sendgrid-csharp Version: v8.0.5
- .NET Version: 4.5.2