Fetch f = new Fetch("https://httpbin.org/patch");
string result = f.Get();
// 判斷請求失敗
if (result == null)
Console.WriteLine("失敗: " + f.StatusCode + " 原因: " + f.GetResponse());
else
Console.WriteLine(result);
輸出:
失敗: 405 原因: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The method is not allowed for the requested URL.</p>