Skip to content

Commit 77be962

Browse files
committed
BizHawk#4187 Add a method to the comm LUA library to allow setting ExpectContinue
1 parent fe8bc2d commit 77be962

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/BizHawk.Client.Common/Api/HttpCommunication.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public sealed class HttpCommunication
2020

2121
public int Timeout { get; set; }
2222

23+
public bool ExpectContinue { get; set; } = true;
24+
2325
public HttpCommunication(Func<byte[]> takeScreenshotCallback, string getURL, string postURL)
2426
{
2527
_takeScreenshotCallback = takeScreenshotCallback;
@@ -49,6 +51,7 @@ public async Task<string> Get(string url)
4951
public async Task<string> Post(string url, FormUrlEncodedContent content)
5052
{
5153
_client.DefaultRequestHeaders.ConnectionClose = true;
54+
_client.DefaultRequestHeaders.ExpectContinue = ExpectContinue;
5255
HttpResponseMessage response;
5356
try
5457
{

src/BizHawk.Client.Common/lua/CommonLibs/CommLuaLibrary.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ public void HttpSetGetUrl(string url)
231231
APIs.Comm.HTTP.GetUrl = url;
232232
}
233233

234+
[LuaMethod("httpSetExpectContinue", "Set ExpectContinue boolean to an explicit value")]
235+
public void HttpSetExpectContinue(bool value)
236+
{
237+
CheckHttp();
238+
APIs.Comm.HTTP.ExpectContinue = value;
239+
}
240+
234241
[LuaMethod("httpGetPostUrl", "Gets HTTP POST URL")]
235242
public string HttpGetPostUrl()
236243
{
@@ -245,6 +252,13 @@ public string HttpGetGetUrl()
245252
return APIs.Comm.HTTP?.GetUrl;
246253
}
247254

255+
[LuaMethod("httpGetExpectContinue", "Get ExpectContinue value")]
256+
public bool HttpGetExpectContinue()
257+
{
258+
CheckHttp();
259+
return APIs.Comm.HTTP.ExpectContinue;
260+
}
261+
248262
private void CheckHttp()
249263
{
250264
if (APIs.Comm.HTTP == null)

0 commit comments

Comments
 (0)