You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ahh, looking at the code I think your suggestion before might work here. I think we can use the OnAfterRequest callback for the request to be able to get the response message so we can do something useful with that (basically save it off to inspect later?) when the download action completes?
Hi, I'm having a similar issue : the server respond an error (406 in my case), but I don't have any indication that the download failed, and I save the body as the expected file I'm downloading (but got an error message in file).
What where you thinking to circumvent the issue ?
At the very least, I want an exception if the server doesn't return a 20X.
Regards,
Ok i found the property. It doesn't work, at least in my 108 version.
No exception thrown, at the very least the stream is empty, so I could check the length.
My workaround work fine.
Activity
alexeyzimarev commentedon Apr 7, 2023
Have you tried setting
ThrowOnAnyErrortotrue? I looked at theDownloadcode and it will throw in your case.nssoft-rlagrange commentedon Apr 7, 2023
I don't have this property on 108.
I found a workaround by settings the AfterRequest delegate :
alexeyzimarev commentedon Apr 7, 2023
ThrowOnAnyErroris the client option that exists since v107. Before that it was the client property.https://restsharp.dev/error-handling.html
nssoft-rlagrange commentedon Apr 7, 2023
Ok i found the property. It doesn't work, at least in my 108 version.
No exception thrown, at the very least the stream is empty, so I could check the length.
My workaround work fine.
alexeyzimarev commentedon Apr 7, 2023
It was fixed by this PR #1962. I am not sure what version was release after that.