Skip to content

Commit

Permalink
Cleanup and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Oren Novotny committed Jun 20, 2018
1 parent bc81dd1 commit c2e3678
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion Directory.build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<PackageProjectUrl>https://github.com/reactiveui/refit</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/reactiveui/refit/blob/master/COPYING</PackageLicenseUrl>
<DefaultLanguage>en-US</DefaultLanguage>
<IncludeSymbols>false</IncludeSymbols>
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<Description>The automatic type-safe REST library for Xamarin and .NET</Description>
<NoWarn>$(NoWarn);1701;1702;CS1591;NU1701</NoWarn>
Expand Down
7 changes: 7 additions & 0 deletions Refit.HttpClientFactory/HttpClientFactoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ namespace Refit
{
public static class HttpClientFactoryExtensions
{
/// <summary>
/// Adds a Refit client to the DI container
/// </summary>
/// <typeparam name="T">Type of the Refit interface</typeparam>
/// <param name="services">container</param>
/// <param name="settings">Optional. Settings to configure the instance with</param>
/// <returns></returns>
public static IHttpClientBuilder AddRefitClient<T>(this IServiceCollection services, RefitSettings settings = null) where T : class
{
services.AddSingleton(provider => RequestBuilder.ForType<T>(settings));
Expand Down
6 changes: 3 additions & 3 deletions Refit.Tests/RequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ public void HttpContentAsApiResponseTest()
Assert.NotNull(task.Result.Headers);
Assert.True(task.Result.IsSuccessStatusCode);
Assert.NotNull(task.Result.ReasonPhrase);
Assert.False(task.Result.StatusCode == default(HttpStatusCode));
Assert.False(task.Result.StatusCode == default);
Assert.NotNull(task.Result.Version);

Assert.Equal(testHttpMessageHandler.RequestMessage.Content, mpc);
Expand Down Expand Up @@ -676,7 +676,7 @@ public void StreamResponseAsApiResponseTest()
Assert.NotNull(task.Result.Headers);
Assert.True(task.Result.IsSuccessStatusCode);
Assert.NotNull(task.Result.ReasonPhrase);
Assert.False(task.Result.StatusCode == default(HttpStatusCode));
Assert.False(task.Result.StatusCode == default);
Assert.NotNull(task.Result.Version);

using (var reader = new StreamReader(task.Result.Content))
Expand Down Expand Up @@ -918,7 +918,7 @@ public void ReadStringContentWithMetadata()
Assert.NotNull(task.Result.Headers);
Assert.True(task.Result.IsSuccessStatusCode);
Assert.NotNull(task.Result.ReasonPhrase);
Assert.False(task.Result.StatusCode == default(HttpStatusCode));
Assert.False(task.Result.StatusCode == default);
Assert.NotNull(task.Result.Version);

Assert.Equal("test", task.Result.Content);
Expand Down
4 changes: 2 additions & 2 deletions Refit.Tests/RestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public async Task HitTheGitHubUserApiAsApiResponse()
Assert.True(result.IsSuccessStatusCode);
Assert.NotNull(result.ReasonPhrase);
Assert.NotNull(result.RequestMessage);
Assert.False(result.StatusCode == default(HttpStatusCode));
Assert.False(result.StatusCode == default);
Assert.NotNull(result.Version);
Assert.Equal("octocat", result.Content.Login);
Assert.False(string.IsNullOrEmpty(result.Content.AvatarUrl));
Expand Down Expand Up @@ -362,7 +362,7 @@ public async Task HitTheGitHubUserApiAsObservableApiResponse()
Assert.True(result.IsSuccessStatusCode);
Assert.NotNull(result.ReasonPhrase);
Assert.NotNull(result.RequestMessage);
Assert.False(result.StatusCode == default(HttpStatusCode));
Assert.False(result.StatusCode == default);
Assert.NotNull(result.Version);
Assert.Equal("octocat", result.Content.Login);
Assert.False(string.IsNullOrEmpty(result.Content.AvatarUrl));
Expand Down

0 comments on commit c2e3678

Please sign in to comment.