|
@@ -47,6 +47,9 @@ namespace Vit.Core.Util.Net
|
|
case byte[] bytes:
|
|
case byte[] bytes:
|
|
httpRequest.Content = new ByteArrayContent(bytes);
|
|
httpRequest.Content = new ByteArrayContent(bytes);
|
|
break;
|
|
break;
|
|
|
|
+ case string str:
|
|
|
|
+ httpRequest.Content = new System.Net.Http.StringContent(str);
|
|
|
|
+ break;
|
|
case HttpContent httpContent:
|
|
case HttpContent httpContent:
|
|
httpRequest.Content = httpContent;
|
|
httpRequest.Content = httpContent;
|
|
break;
|
|
break;
|
|
@@ -93,11 +96,16 @@ namespace Vit.Core.Util.Net
|
|
|
|
|
|
//if (response.IsSuccessStatusCode)
|
|
//if (response.IsSuccessStatusCode)
|
|
{
|
|
{
|
|
- if (typeof(byte[]).IsAssignableFrom(typeof(T)))
|
|
|
|
|
|
+ if (typeof(T) == typeof(byte[]))
|
|
{
|
|
{
|
|
object data = await response.Content.ReadAsByteArrayAsync();
|
|
object data = await response.Content.ReadAsByteArrayAsync();
|
|
httpResponse.data = (T)data;
|
|
httpResponse.data = (T)data;
|
|
}
|
|
}
|
|
|
|
+ else if (typeof(T) == typeof(string))
|
|
|
|
+ {
|
|
|
|
+ object data = await response.Content.ReadAsStringAsync();
|
|
|
|
+ httpResponse.data = (T)data;
|
|
|
|
+ }
|
|
else
|
|
else
|
|
{
|
|
{
|
|
string data = await response.Content.ReadAsStringAsync();
|
|
string data = await response.Content.ReadAsStringAsync();
|