mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-09 07:09:41 -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 {
|
||||
HttpWebRequest req = HttpUtil.CreateRequest(Host + msg.Path);
|
||||
req.Method = msg.Method;
|
||||
req.ContentType = "application/json";
|
||||
req.Headers[HttpRequestHeader.Authorization] = "Bot " + Token;
|
||||
|
||||
string data = Json.SerialiseObject(msg.ToJson());
|
||||
HttpUtil.SetRequestData(req, Encoding.UTF8.GetBytes(data));
|
||||
JsonObject obj = msg.ToJson();
|
||||
if (obj != null) {
|
||||
req.ContentType = "application/json";
|
||||
string data = Json.SerialiseObject(obj);
|
||||
HttpUtil.SetRequestData(req, Encoding.UTF8.GetBytes(data));
|
||||
}
|
||||
|
||||
msg.OnRequest(req);
|
||||
res = req.GetResponse();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user