mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Revert "fix: Edgegap Plugin 'InvalidOperationException: This instance has already started one or more requests.' when trying to Connect->Disconnect->Reconnect"
This reverts commit 68d768b871
.
This commit is contained in:
parent
bd85c74f52
commit
bccebc67b4
@ -250,29 +250,16 @@ string selectedApiTokenValue
|
|||||||
{
|
{
|
||||||
SetToolUIState(ToolState.Connecting);
|
SetToolUIState(ToolState.Connecting);
|
||||||
|
|
||||||
|
_httpClient.BaseAddress = new Uri(selectedApiEnvironment.GetApiUrl());
|
||||||
|
|
||||||
// MIRROR CHANGE ///////////////////////////////////////////////////
|
|
||||||
// the old code throws an exception when trying to connect again after disconnecting:
|
|
||||||
// "InvalidOperationException: This instance has already started one or more requests. Properties can only be modified before sending the first request."
|
|
||||||
// _httpClient.BaseAddress = new Uri(selectedApiEnvironment.GetApiUrl());
|
|
||||||
// string path = $"/v1/app/{selectedAppName}/version/{selectedAppVersionName}";
|
|
||||||
// _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
||||||
// _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token", selectedApiTokenValue);
|
|
||||||
// HttpResponseMessage response = await _httpClient.GetAsync(path);
|
|
||||||
//
|
|
||||||
// solution: https://stackoverflow.com/questions/51478525/httpclient-this-instance-has-already-started-one-or-more-requests-properties-ca
|
|
||||||
// "Rather than setting DefaultRequestHeaders, set the headers on each HttpRequestMessage you are sending."
|
|
||||||
|
|
||||||
// Create the request message
|
|
||||||
string baseUrl = selectedApiEnvironment.GetApiUrl();
|
|
||||||
string path = $"/v1/app/{selectedAppName}/version/{selectedAppVersionName}";
|
string path = $"/v1/app/{selectedAppName}/version/{selectedAppVersionName}";
|
||||||
Uri fullUrl = new Uri(new Uri(baseUrl), path);
|
|
||||||
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, fullUrl);
|
// Headers
|
||||||
request.Headers.Accept.Clear();
|
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||||
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token", selectedApiTokenValue);
|
||||||
request.Headers.Authorization = new AuthenticationHeaderValue("token", selectedApiTokenValue);
|
|
||||||
HttpResponseMessage response = await _httpClient.SendAsync(request);
|
// Make HTTP request
|
||||||
// END MIRROR CHANGE ///////////////////////////////////////////////
|
HttpResponseMessage response = await _httpClient.GetAsync(path);
|
||||||
|
|
||||||
if (response.IsSuccessStatusCode)
|
if (response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user