wasSharp

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 55  →  ?path2? @ 56
/Web/wasHTTPClient.cs
@@ -439,6 +439,35 @@
// Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 //
///////////////////////////////////////////////////////////////////////////
/// <summary>
/// Asynchronously sends a POST request to an URL with set key-value pairs.
/// </summary>
/// <param name="URL">the url to send the message to</param>
/// <param name="message">key-value pairs to send</param>
public async Task<byte[]> POST(string URL, IEnumerable<KeyValuePair<Task<string>, Task<string>>> message)
{
try
{
using (var content =
new StringContent(KeyValue.Encode(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>
/// Sends a GET request to an URL with set key-value pairs.
/// </summary>
/// <param name="URL">the url to send the message to</param>