mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Content-Type custom header is now allowed for GET and HEAD. Empty POST data issue fixed.
This commit is contained in:
Binary file not shown.
@@ -391,7 +391,7 @@ namespace RuriLib
|
|||||||
var pData = string.Join(Environment.NewLine, postData
|
var pData = string.Join(Environment.NewLine, postData
|
||||||
.Split(new string[] { "\\n" }, StringSplitOptions.None)
|
.Split(new string[] { "\\n" }, StringSplitOptions.None)
|
||||||
.Select(p => ReplaceValues(p, data)));
|
.Select(p => ReplaceValues(p, data)));
|
||||||
if (pData != "")
|
if (CanContainBody(method))
|
||||||
{
|
{
|
||||||
if (encodeContent)
|
if (encodeContent)
|
||||||
{
|
{
|
||||||
@@ -439,7 +439,7 @@ namespace RuriLib
|
|||||||
|
|
||||||
// Set headers
|
// Set headers
|
||||||
data.Log(new LogEntry("Sent Headers:", Colors.DarkTurquoise));
|
data.Log(new LogEntry("Sent Headers:", Colors.DarkTurquoise));
|
||||||
var fixedNames = Enum.GetNames(typeof(HttpHeader)).Select(n => n.ToLower());
|
// var fixedNames = Enum.GetNames(typeof(HttpHeader)).Select(n => n.ToLower());
|
||||||
foreach (var header in CustomHeaders)
|
foreach (var header in CustomHeaders)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -448,8 +448,8 @@ namespace RuriLib
|
|||||||
var replacedKey = key.Replace("-", "").ToLower(); // Used to compare with the HttpHeader enum
|
var replacedKey = key.Replace("-", "").ToLower(); // Used to compare with the HttpHeader enum
|
||||||
var val = ReplaceValues(header.Value, data);
|
var val = ReplaceValues(header.Value, data);
|
||||||
|
|
||||||
if (replacedKey == "contenttype") { } // Disregard additional Content-Type headers
|
if (replacedKey == "contenttype" && content != null) { continue; } // Disregard additional Content-Type headers
|
||||||
else if (fixedNames.Contains(replacedKey)) request.AddHeader((HttpHeader)Enum.Parse(typeof(HttpHeader), replacedKey, true), val);
|
// else if (fixedNames.Contains(replacedKey)) request.AddHeader((HttpHeader)Enum.Parse(typeof(HttpHeader), replacedKey, true), val);
|
||||||
else request.AddHeader(key, val);
|
else request.AddHeader(key, val);
|
||||||
|
|
||||||
data.Log(new LogEntry(key + ": " + val, Colors.MediumTurquoise));
|
data.Log(new LogEntry(key + ": " + val, Colors.MediumTurquoise));
|
||||||
@@ -685,6 +685,11 @@ namespace RuriLib
|
|||||||
}
|
}
|
||||||
return $"------WebKitFormBoundary{builder.ToString().ToLower()}";
|
return $"------WebKitFormBoundary{builder.ToString().ToLower()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool CanContainBody(HttpMethod method)
|
||||||
|
{
|
||||||
|
return method == HttpMethod.POST || method == HttpMethod.PUT || method == HttpMethod.DELETE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user