diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-31 15:02:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-31 15:02:03 +0800 |
commit | 2de7fa95bb5ad0a10f74fb390bac464a250dee42 (patch) | |
tree | ba42530cf4f13621a7a3a7ff661e383117119883 /Timeline.Tests/Helpers/HttpClientExtensions.cs | |
parent | f08f53d6fcd9baf9dd3b95209f7c7448ae8168d4 (diff) | |
parent | cf2055f956695bc0b9ecdb6d8023d0d199b98462 (diff) | |
download | timeline-2de7fa95bb5ad0a10f74fb390bac464a250dee42.tar.gz timeline-2de7fa95bb5ad0a10f74fb390bac464a250dee42.tar.bz2 timeline-2de7fa95bb5ad0a10f74fb390bac464a250dee42.zip |
Merge pull request #53 from crupest/nickname
Add nickname support.
Diffstat (limited to 'Timeline.Tests/Helpers/HttpClientExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/HttpClientExtensions.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/HttpClientExtensions.cs b/Timeline.Tests/Helpers/HttpClientExtensions.cs index 38641f90..6513bbe7 100644 --- a/Timeline.Tests/Helpers/HttpClientExtensions.cs +++ b/Timeline.Tests/Helpers/HttpClientExtensions.cs @@ -35,5 +35,17 @@ namespace Timeline.Tests.Helpers content.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
return client.PutAsync(url, content);
}
+
+ public static Task<HttpResponseMessage> PutStringAsync(this HttpClient client, string url, string body, string mimeType = null)
+ {
+ return client.PutStringAsync(new Uri(url, UriKind.RelativeOrAbsolute), body, mimeType);
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2000:Dispose objects before losing scope")]
+ public static Task<HttpResponseMessage> PutStringAsync(this HttpClient client, Uri url, string body, string mimeType = null)
+ {
+ var content = new StringContent(body, Encoding.UTF8, mimeType ?? MediaTypeNames.Text.Plain);
+ return client.PutAsync(url, content);
+ }
}
}
|