Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit a766081

Browse files
committed
Fix SendAsync in HttpUtils to only run on success
1 parent bcabaec commit a766081

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ServiceStack.Text/HttpUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,15 @@ public static Task<string> SendStringToUrlAsync(this string url, string method =
353353
var webRes = task.Result;
354354
if (responseFilter != null)
355355
{
356-
responseFilter((HttpWebResponse)webRes);
356+
responseFilter(webRes);
357357
}
358358

359359
using (var stream = webRes.GetResponseStream())
360360
using (var reader = new StreamReader(stream))
361361
{
362362
return reader.ReadToEnd();
363363
}
364-
});
364+
}, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.OnlyOnRanToCompletion);
365365
}
366366

367367
public static string SendStringToUrl(this string url, string method = null,

0 commit comments

Comments
 (0)