Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

Commit

Permalink
Convert absolute URI with ToString() (which should fix #42)
Browse files Browse the repository at this point in the history
  • Loading branch information
fubar-coder committed Sep 25, 2015
1 parent 5e470bc commit 5711c59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion RestSharp.Portable.Core/RestRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public RestRequest([NotNull] Uri resource)
/// <param name="resource">The resource this request is targeting</param>
/// <param name="method">The HTTP request method</param>
public RestRequest([NotNull] Uri resource, Method method)
: this(resource.IsAbsoluteUri ? resource.AbsolutePath + resource.Query : resource.OriginalString, method)
: this(resource.IsAbsoluteUri ? resource.ToString() : resource.OriginalString, method)
{
}

Expand Down
14 changes: 14 additions & 0 deletions RestSharp.Portable.Test/OtherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,19 @@ public void TestUserAgent(Type factoryType)
Assert.Equal("TestUserAgent/1", (string)client.DefaultParameters.Single(x => StringComparer.OrdinalIgnoreCase.Equals(x.Name, "User-Agent")).Value);
}
}

[Fact]
public void TestCombineRequestUrl()
{
using (var client = new RestSharp.Portable.WebRequest.RestClient("https://www.itsg-trust.de/ostc/")
{
HttpClientFactory = CreateClientFactory(typeof(WebRequestHttpClientFactory), false),
})
{
var request = new RestRequest(new Uri("http://www.itsg.de/tc_keys_arbeitgeberverfahren.ITSG"));
var targetUri = client.BuildUri(request);
Assert.Equal(new Uri("http://www.itsg.de/tc_keys_arbeitgeberverfahren.ITSG"), targetUri);
}
}
}
}

0 comments on commit 5711c59

Please sign in to comment.