Skip to content

Commit

Permalink
Reenable RestMethodInfo, but our public one instead
Browse files Browse the repository at this point in the history
amend
  • Loading branch information
anaisbetts committed Apr 21, 2023
1 parent 1923704 commit 4bf75bb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Refit.Tests/RequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2195,8 +2195,8 @@ public void RestMethodInfoShouldBeInProperties()
#else
Assert.NotEmpty(output.Properties);
Assert.True(output.Properties.TryGetValue(HttpRequestMessageOptions.RestMethodInfo, out var restMethodInfoObj));
Assert.IsType<RestMethodInfoInternal>(restMethodInfoObj);
var restMethodInfo = restMethodInfoObj as RestMethodInfoInternal;
Assert.IsType<RestMethodInfo>(restMethodInfoObj);
var restMethodInfo = restMethodInfoObj as RestMethodInfo;
#endif
Assert.Equal(nameof(IContainAandB.Ping), restMethodInfo.Name);
}
Expand Down
2 changes: 1 addition & 1 deletion Refit/HttpRequestMessageProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public static class HttpRequestMessageOptions
/// <summary>
/// Returns the <see cref="Refit.RestMethodInfoInternal"/> of the top-level interface
/// </summary>
//public static string RestMethodInfo { get; } = "Refit.RestMethodInfo";
public static string RestMethodInfo { get; } = "Refit.RestMethodInfo";
}
}
4 changes: 2 additions & 2 deletions Refit/RequestBuilderImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,10 @@ Func<object[], HttpRequestMessage> BuildRequestFactoryForMethod(RestMethodInfoIn
// Always add the top-level type of the interface to the properties
#if NET6_0_OR_GREATER
ret.Options.Set(new HttpRequestOptionsKey<Type>(HttpRequestMessageOptions.InterfaceType), TargetType);
ret.Options.Set(new HttpRequestOptionsKey<RestMethodInfo>(HttpRequestMessageOptions.RestMethodInfo), restMethod);
ret.Options.Set(new HttpRequestOptionsKey<RestMethodInfo>(HttpRequestMessageOptions.RestMethodInfo), restMethod.ToRestMethodInfo());
#else
ret.Properties[HttpRequestMessageOptions.InterfaceType] = TargetType;
ret.Properties[HttpRequestMessageOptions.RestMethodInfo] = restMethod;
ret.Properties[HttpRequestMessageOptions.RestMethodInfo] = restMethod.ToRestMethodInfo();
#endif

// NB: The URI methods in .NET are dumb. Also, we do this
Expand Down
2 changes: 1 addition & 1 deletion Refit/RestMethodInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static class IsExternalInit { }

namespace Refit
{
public record RestMethodInfo(string name, Type hostingType, MethodInfo methodInfo, string relativePath, Type returnType);
public record RestMethodInfo(string Name, Type HostingType, MethodInfo MethodInfo, string RelativePath, Type ReturnType);

[DebuggerDisplay("{MethodInfo}")]
internal class RestMethodInfoInternal
Expand Down

0 comments on commit 4bf75bb

Please sign in to comment.