mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-12 16:56:33 -04:00
Discord: Don't set JSON content type when json data is null
This commit is contained in:
parent
2c46cd7b0e
commit
834adbaf2d
@ -59,11 +59,15 @@ namespace MCGalaxy.Modules.Relay.Discord
|
|||||||
try {
|
try {
|
||||||
HttpWebRequest req = HttpUtil.CreateRequest(Host + msg.Path);
|
HttpWebRequest req = HttpUtil.CreateRequest(Host + msg.Path);
|
||||||
req.Method = msg.Method;
|
req.Method = msg.Method;
|
||||||
req.ContentType = "application/json";
|
|
||||||
req.Headers[HttpRequestHeader.Authorization] = "Bot " + Token;
|
req.Headers[HttpRequestHeader.Authorization] = "Bot " + Token;
|
||||||
|
|
||||||
string data = Json.SerialiseObject(msg.ToJson());
|
JsonObject obj = msg.ToJson();
|
||||||
HttpUtil.SetRequestData(req, Encoding.UTF8.GetBytes(data));
|
if (obj != null) {
|
||||||
|
req.ContentType = "application/json";
|
||||||
|
string data = Json.SerialiseObject(obj);
|
||||||
|
HttpUtil.SetRequestData(req, Encoding.UTF8.GetBytes(data));
|
||||||
|
}
|
||||||
|
|
||||||
msg.OnRequest(req);
|
msg.OnRequest(req);
|
||||||
res = req.GetResponse();
|
res = req.GetResponse();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user