Hi,
so 'm calling a web api that should return for example this in case of 500 (success)
{
"msg": "no msg",
"error": "error msg"
}
and let's say this in case of error (401,400...etcc)
{
"msg": "msg true",
"error": "null"
}
when i call the web api, if it was successful, i'll get the msg:msg true and error:null
System.Net.HttpWebResponse response = _request.GetResponse();
using (System.IO.StreamReader streamReader = new System.IO.StreamReader(response.GetResponseStream()))
{
str webResponse = streamReader.ReadToEnd();
return webResponse;
}
However if the call failed, i'll get for example unauthorized error or bad request. But i can't get the error message returned by postman which is
msg:" no msg" and error:"error msg" ... is there a way to get the result when it fails?