Fixups to signature of `HttpCommunication.ContentObjectFor` method
fixes 41547824a
This commit is contained in:
parent
1437bc3a98
commit
d8508acb69
|
@ -1,5 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -11,6 +10,15 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
private const string MIME_FORM_URLENC = "application/x-www-form-urlencoded";
|
||||
|
||||
public static HttpContent ContentObjectFor(string payload, string mimeType)
|
||||
=> mimeType switch
|
||||
{
|
||||
MIME_FORM_URLENC => new FormUrlEncodedContent([ new("payload", payload) ]),
|
||||
#pragma warning disable BHI1005 // exception type
|
||||
_ => throw new NotImplementedException()
|
||||
#pragma warning restore BHI1005
|
||||
};
|
||||
|
||||
private readonly HttpClient _client = new HttpClient();
|
||||
|
||||
private readonly Func<byte[]> _takeScreenshotCallback;
|
||||
|
@ -33,15 +41,6 @@ namespace BizHawk.Client.Common
|
|||
_client.DefaultRequestHeaders.UserAgent.ParseAdd(VersionInfo.UserAgentEscaped);
|
||||
}
|
||||
|
||||
private HttpContent ContentObjectFor(string payload, [ConstantExpected] string mimeType)
|
||||
=> mimeType switch
|
||||
{
|
||||
MIME_FORM_URLENC => new FormUrlEncodedContent([ new("payload", payload) ]),
|
||||
#pragma warning disable BHI1005 // exception type
|
||||
_ => throw new NotImplementedException()
|
||||
#pragma warning restore BHI1005
|
||||
};
|
||||
|
||||
public string ExecGet(string url = null) => Get(url ?? GetUrl).Result;
|
||||
|
||||
/// <inheritdoc cref="ExecPostAsForm"/>
|
||||
|
|
Loading…
Reference in New Issue