-
-
Notifications
You must be signed in to change notification settings - Fork 760
Add MethodInfo property #1219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MethodInfo property #1219
Conversation
Can someone review this? It's not that big, but it makes things easier. |
I discussed this with @anaisbetts and we agreed that the type being stored in the dictionary should be a |
Thanks for your reply! |
I think strong type is reasonable, because refit http attributes are applied on the method which is a strong type. |
Seems this is an issue people seem to have a difference of opinion hence why I liked my configurable approach... :( |
I love it too. I love either of them to be merged more. Our project currently is using an ugly&complex workaround to just get the executing method... |
I just opened #1317 which is very closely related but goes a little bit further by exposing the full But I should definitively have looked at open pull requests first! |
If I understand correctly, you are talking about #1180, am I right? |
I would love to have this to be able to override services
.AddRefitClient()
.ConfigureHttpClient(httpClient => httpClient.Timeout = TimeSpan.FromSeconds(30)); public class HttpMessageHandler : DelegatingHandler
{
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var timeoutSeconds = 15; // ToDo: read configuration for operation identified by request.Options[HttpRequestMessageOptions.MethodInfo]
using var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutSeconds));
return await base.SendAsync(request, timeoutTokenSource.Token);
}
} |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What kind of change does this PR introduce?
feature
What is the current behavior?
As #1150 and #1156 described, currently, we are not able to get information on the executing method. The information is useful for url tags, additional behavior based on custom attributes, and other things.
What is the new behavior?
Added
MethodInfo
of the current method into request properties.Now you can grab the custom attributes and o 8000 ther method info from the request properties in
DelegatingHandler
.What might this PR break?
There is nothing to break. Just one additional item in the request property/option list.
Please check if the PR fulfills these requirements
Other information:
NA