Rename `HttpCommunication.ExecPost` and add docs

This commit is contained in:
YoshiRulz 2025-01-17 00:45:30 +10:00
parent 88c54d11b6
commit 08dd34f42b
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 12 additions and 1 deletions

View File

@ -32,7 +32,17 @@ namespace BizHawk.Client.Common
public string ExecGet(string url = null) => Get(url ?? GetUrl).Result;
/// <inheritdoc cref="ExecPostAsForm"/>
[Obsolete($"renamed to {nameof(ExecPostAsForm)}")]
public string ExecPost(string url = null, string payload = "")
=> ExecPostAsForm(url: url, payload: payload);
#pragma warning disable DOC105 // false positive detecting param name in doc comment
/// <remarks>
/// uses <see cref="FormUrlEncodedContent"/> (<c>application/x-www-form-urlencoded</c>),
/// containing a single pair with key <c>payload</c> (literal) and value <paramref name="payload"/> (argument)
/// </remarks>
public string ExecPostAsForm(string url = null, string payload = "")
{
return Post(
url ?? PostUrl,
@ -40,6 +50,7 @@ namespace BizHawk.Client.Common
sendAdvanceRequest: payload.Length >= ExpectContinueThreshold
).Result;
}
#pragma warning restore DOC105
public async Task<string> Get(string url)
{

View File

@ -200,7 +200,7 @@ namespace BizHawk.Client.Common
public string HttpPost(string url, string payload)
{
CheckHttp();
return APIs.Comm.HTTP?.ExecPost(url, payload);
return APIs.Comm.HTTP?.ExecPostAsForm(url: url, payload: payload);
}
[LuaMethod("httpPostScreenshot", "HTTP POST screenshot")]