diff options
author | 杨宇千 <crupest@outlook.com> | 2019-08-19 01:44:29 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-08-19 01:44:29 +0800 |
commit | 09af59ea133d01bbbeba76a448563189fa39e440 (patch) | |
tree | 6dd38c932babe4be032385f27ddff50645d48b38 /Timeline.Tests/Helpers/HttpClientExtensions.cs | |
parent | 2c50b2bebc15a2ae48fb124fcf090d32c043d62b (diff) | |
download | timeline-09af59ea133d01bbbeba76a448563189fa39e440.tar.gz timeline-09af59ea133d01bbbeba76a448563189fa39e440.tar.bz2 timeline-09af59ea133d01bbbeba76a448563189fa39e440.zip |
Add integrated tests.
Diffstat (limited to 'Timeline.Tests/Helpers/HttpClientExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/HttpClientExtensions.cs | 9 |
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);
+ }
}
}
|