aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/HttpClientExtensions.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-08-19 01:52:36 +0800
committerGitHub <noreply@github.com>2019-08-19 01:52:36 +0800
commit501fe7b988dfbdea7a62f78cb50c1ac66d5f4a20 (patch)
treee1091ffcf9e3571c1a9de4a71b12f0527397af19 /Timeline.Tests/Helpers/HttpClientExtensions.cs
parent0630fd020ec11e343b787a18d70f1f13fdb350b3 (diff)
parent5808bd6efb42847560ed10b2cc56323594d241de (diff)
downloadtimeline-501fe7b988dfbdea7a62f78cb50c1ac66d5f4a20.tar.gz
timeline-501fe7b988dfbdea7a62f78cb50c1ac66d5f4a20.tar.bz2
timeline-501fe7b988dfbdea7a62f78cb50c1ac66d5f4a20.zip
Merge pull request #43 from crupest/avatar
Add avatar feature.
Diffstat (limited to 'Timeline.Tests/Helpers/HttpClientExtensions.cs')
-rw-r--r--Timeline.Tests/Helpers/HttpClientExtensions.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/HttpClientExtensions.cs b/Timeline.Tests/Helpers/HttpClientExtensions.cs
index cd40d91e..b9204fcc 100644
--- a/Timeline.Tests/Helpers/HttpClientExtensions.cs
+++ b/Timeline.Tests/Helpers/HttpClientExtensions.cs
@@ -1,5 +1,6 @@
using Newtonsoft.Json;
using System.Net.Http;
+using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
@@ -11,5 +12,13 @@ namespace Timeline.Tests.Helpers
{
return client.PatchAsync(url, new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json"));
}
+
+ public static Task<HttpResponseMessage> PutByteArrayAsync(this HttpClient client, string url, byte[] body, string mimeType)
+ {
+ var content = new ByteArrayContent(body);
+ content.Headers.ContentLength = body.Length;
+ content.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
+ return client.PutAsync(url, content);
+ }
}
}