diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
index 11a5cdf083..ffde10bfed 100644
--- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
@@ -399,11 +399,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
/// stream on success, null on failure
public async Task Post(HttpRequestOptions options, Dictionary postData)
{
- var strings = postData.Keys.Select(key => string.Format("{0}={1}", key, postData[key]));
- var postContent = string.Join("&", strings.ToArray());
-
- options.RequestContent = postContent;
- options.RequestContentType = "application/x-www-form-urlencoded";
+ options.SetPostData(postData);
var response = await Post(options).ConfigureAwait(false);
diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
index 74c8122265..4b0c956162 100644
--- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
+++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj
@@ -122,7 +122,7 @@
-
+
if '$(ConfigurationName)' == 'Release' (
xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj
index fd41c7e9e9..661073c89e 100644
--- a/MediaBrowser.Common/MediaBrowser.Common.csproj
+++ b/MediaBrowser.Common/MediaBrowser.Common.csproj
@@ -116,7 +116,7 @@
-
+
if '$(ConfigurationName)' == 'Release' (
xcopy "$(TargetPath)" "$(SolutionDir)\Nuget\dlls\" /y /d /r /i
diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs
index a2b42dedbe..97da493185 100644
--- a/MediaBrowser.Common/Net/HttpRequestOptions.cs
+++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading;
namespace MediaBrowser.Common.Net
@@ -111,5 +112,14 @@ namespace MediaBrowser.Common.Net
LogRequest = true;
}
+
+ public void SetPostData(IDictionary values)
+ {
+ var strings = values.Keys.Select(key => string.Format("{0}={1}", key, values[key]));
+ var postContent = string.Join("&", strings.ToArray());
+
+ RequestContent = postContent;
+ RequestContentType = "application/x-www-form-urlencoded";
+ }
}
}
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
index fba098dab3..af1628ba47 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
@@ -10,7 +10,6 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -113,7 +112,12 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var url = "Servers";
url = GetConnectUrl(url);
- var postData = new Dictionary {{"name", _appHost.FriendlyName}, {"url", wanApiAddress}};
+
+ var postData = new Dictionary
+ {
+ {"name", _appHost.FriendlyName},
+ {"url", wanApiAddress}
+ };
using (var stream = await _httpClient.Post(url, postData, CancellationToken.None).ConfigureAwait(false))
{
@@ -131,12 +135,24 @@ namespace MediaBrowser.Server.Implementations.Connect
var url = "Servers";
url = GetConnectUrl(url);
url += "?id=" + ConnectServerId;
- var postData = new Dictionary {{"name", _appHost.FriendlyName}, {"url", wanApiAddress}};
// TODO: Add Access-Key http request header
+ var options = new HttpRequestOptions
+ {
+ Url = url,
+ CancellationToken = CancellationToken.None
+ };
+
+ options.SetPostData(new Dictionary
+ {
+ {"name", _appHost.FriendlyName},
+ {"url", wanApiAddress}
+ });
+
+ options.RequestHeaders.Add("X-Connect-Token", ConnectAccessKey);
// No need to examine the response
- using (var stream = await _httpClient.Post(url, postData, CancellationToken.None).ConfigureAwait(false))
+ using (var stream = (await _httpClient.Post(options).ConfigureAwait(false)).Content)
{
}
}