8000 feature: Allow decoration of interface methods to be used by DelegatingHandlers · Issue #1156 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
feature: Allow decoration of interface methods to be used by DelegatingHandlers #1156
Open
@davidkvc

Description

@davidkvc

Problem:

I want to be able to make decisions in DelegatingHandler based on the client
interface method being executed.

Specifically I want to apply retry logic to some requests. I would like to be able
to have one DelegatingHandler type for that and be able to somehow mark
interface methods where retry should be allowed. Deciding only based on request
method is not enough.

Describe the solution you'd like

One possible solution is to add another property to HttpRequestMessage.Properties/Options
that would contain MethodInfo of the method. Then I could define custom attribute that can
mark methods where retry is enabled and my DelegatingHandler could look for that attribute.

Another solution could be to add a new attribute like ConstantProperty that could be used
on method. It would work like existing PropertyAttribute with the difference that the value
of the property would be specified in constructor and would be constant. Again, I could look
for that property in the DelegatingHandler

Describe alternatives you've considered

I don't really see how could this be done today in a clean way. The only way to pass additional
information to DelegatingHandler is through PropertyAttribute but that requires adding
method parameter which is not right. Caller shouldn't have to pass another value to each
method to manage how the client works internally.

Additional context

#1150 seems like similar request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0