fix HttpGet method
This commit is contained in:
@@ -156,7 +156,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public void HttpRequest(string url, LuaCsAction callback, string data, string method = "POST", string contentType = "application/json")
|
public void HttpRequest(string url, LuaCsAction callback, string data = null, string method = "POST", string contentType = "application/json")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -164,8 +164,11 @@ namespace Barotrauma
|
|||||||
httpWebRequest.ContentType = contentType;
|
httpWebRequest.ContentType = contentType;
|
||||||
httpWebRequest.Method = method;
|
httpWebRequest.Method = method;
|
||||||
|
|
||||||
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
|
if (data != null)
|
||||||
streamWriter.Write(data);
|
{
|
||||||
|
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
|
||||||
|
streamWriter.Write(data);
|
||||||
|
}
|
||||||
|
|
||||||
httpWebRequest.BeginGetResponse(new AsyncCallback((IAsyncResult result) =>
|
httpWebRequest.BeginGetResponse(new AsyncCallback((IAsyncResult result) =>
|
||||||
{
|
{
|
||||||
@@ -197,9 +200,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void HttpGet(string url, LuaCsAction callback, string data, string contentType = "application/json")
|
public void HttpGet(string url, LuaCsAction callback)
|
||||||
{
|
{
|
||||||
HttpRequest(url, callback, data, "GET", contentType);
|
HttpRequest(url, callback, null, "GET");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async void HandleIncomingConnections(System.Net.HttpListener listener, LuaCsAction onRequestReceived)
|
public static async void HandleIncomingConnections(System.Net.HttpListener listener, LuaCsAction onRequestReceived)
|
||||||
|
|||||||
Reference in New Issue
Block a user