mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Properly set content type
This commit is contained in:
parent
4f17ed961e
commit
b1bd062709
@ -155,7 +155,6 @@ namespace Emby.Dlna.PlayTo
|
|||||||
}
|
}
|
||||||
|
|
||||||
options.RequestContentType = "text/xml";
|
options.RequestContentType = "text/xml";
|
||||||
options.AppendCharsetToMimeType = true;
|
|
||||||
options.RequestContent = postData;
|
options.RequestContent = postData;
|
||||||
|
|
||||||
return _httpClient.Post(options);
|
return _httpClient.Post(options);
|
||||||
|
@ -301,23 +301,15 @@ namespace Emby.Server.Implementations.HttpClientManager
|
|||||||
}
|
}
|
||||||
else if (options.RequestContent != null)
|
else if (options.RequestContent != null)
|
||||||
{
|
{
|
||||||
httpWebRequest.Content = new StringContent(options.RequestContent);
|
httpWebRequest.Content = new StringContent(
|
||||||
|
options.RequestContent,
|
||||||
|
null,
|
||||||
|
options.RequestContentType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
httpWebRequest.Content = new ByteArrayContent(Array.Empty<byte>());
|
httpWebRequest.Content = new ByteArrayContent(Array.Empty<byte>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add correct content type
|
|
||||||
/*
|
|
||||||
var contentType = options.RequestContentType ?? "application/x-www-form-urlencoded";
|
|
||||||
|
|
||||||
if (options.AppendCharsetToMimeType)
|
|
||||||
{
|
|
||||||
contentType = contentType.TrimEnd(';') + "; charset=\"utf-8\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
httpWebRequest.Headers.Add(HeaderNames.ContentType, contentType);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.LogRequest)
|
if (options.LogRequest)
|
||||||
|
@ -91,8 +91,6 @@ namespace MediaBrowser.Common.Net
|
|||||||
|
|
||||||
public bool EnableDefaultUserAgent { get; set; }
|
public bool EnableDefaultUserAgent { get; set; }
|
||||||
|
|
||||||
public bool AppendCharsetToMimeType { get; set; }
|
|
||||||
|
|
||||||
private string GetHeaderValue(string name)
|
private string GetHeaderValue(string name)
|
||||||
{
|
{
|
||||||
RequestHeaders.TryGetValue(name, out var value);
|
RequestHeaders.TryGetValue(name, out var value);
|
||||||
|
@ -57,10 +57,9 @@ namespace Mono.Nat.Upnp
|
|||||||
req.Url = ss;
|
req.Url = ss;
|
||||||
req.EnableKeepAlive = false;
|
req.EnableKeepAlive = false;
|
||||||
req.RequestContentType = "text/xml";
|
req.RequestContentType = "text/xml";
|
||||||
req.AppendCharsetToMimeType = true;
|
|
||||||
req.RequestHeaders.Add("SOAPACTION", "\"" + device.ServiceType + "#" + upnpMethod + "\"");
|
req.RequestHeaders.Add("SOAPACTION", "\"" + device.ServiceType + "#" + upnpMethod + "\"");
|
||||||
|
|
||||||
string bodyString = "<s:Envelope "
|
req.RequestContent = "<s:Envelope "
|
||||||
+ "xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
+ "xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" "
|
||||||
+ "s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
|
+ "s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
|
||||||
+ "<s:Body>"
|
+ "<s:Body>"
|
||||||
@ -70,8 +69,6 @@ namespace Mono.Nat.Upnp
|
|||||||
+ "</u:" + upnpMethod + ">"
|
+ "</u:" + upnpMethod + ">"
|
||||||
+ "</s:Body>"
|
+ "</s:Body>"
|
||||||
+ "</s:Envelope>\r\n\r\n";
|
+ "</s:Envelope>\r\n\r\n";
|
||||||
|
|
||||||
req.RequestContentBytes = System.Text.Encoding.UTF8.GetBytes(bodyString);
|
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user