aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/HttpClientExtensions.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-09 21:48:12 +0800
committerGitHub <noreply@github.com>2019-08-09 21:48:12 +0800
commitd97185e6152a327f6ef3b1873bfd86f1a3aac3a1 (patch)
treef1cf455b758e8bf0265d4db0e42a404e9877b321 /Timeline.Tests/Helpers/HttpClientExtensions.cs
parent29bd71cd93b03248254f341aff9252374abc74ec (diff)
parentc964cbbb6c8f228bd4c3943025c6107ac4e42a13 (diff)
downloadtimeline-d97185e6152a327f6ef3b1873bfd86f1a3aac3a1.tar.gz
timeline-d97185e6152a327f6ef3b1873bfd86f1a3aac3a1.tar.bz2
timeline-d97185e6152a327f6ef3b1873bfd86f1a3aac3a1.zip
Merge pull request #38 from crupest/null-request-field
Do 3 things.
Diffstat (limited to 'Timeline.Tests/Helpers/HttpClientExtensions.cs')
-rw-r--r--Timeline.Tests/Helpers/HttpClientExtensions.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/HttpClientExtensions.cs b/Timeline.Tests/Helpers/HttpClientExtensions.cs
new file mode 100644
index 00000000..cd40d91e
--- /dev/null
+++ b/Timeline.Tests/Helpers/HttpClientExtensions.cs
@@ -0,0 +1,15 @@
+using Newtonsoft.Json;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Timeline.Tests.Helpers
+{
+ public static class HttpClientExtensions
+ {
+ public static Task<HttpResponseMessage> PatchAsJsonAsync<T>(this HttpClient client, string url, T body)
+ {
+ return client.PatchAsync(url, new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json"));
+ }
+ }
+}