wasSharp
/Web/wasHTTPClient.cs |
@@ -373,6 +373,35 @@ |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2017 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
/// <summary> |
/// Sends a POST request to an URL with set message. |
/// </summary> |
/// <param name="URL">the url to send the message to</param> |
/// <param name="message">the message to send</param> |
public async Task<byte[]> POST(string URL, string message) |
{ |
try |
{ |
using (var content = |
new StringContent(message, Encoding.UTF8, MediaType)) |
{ |
using (var response = await HTTPClient.PostAsync(URL, content)) |
{ |
return response.IsSuccessStatusCode |
? await response.Content.ReadAsByteArrayAsync() |
: null; |
} |
} |
} |
catch (Exception) |
{ |
return null; |
} |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |
/// <summary> |