Skip to content

[Question/Feature request] Support for synchronous methods #992

Description

@hankovich

HttpClient in .NET 5 received synchronous Send methods.
I'm interested if future versions of refit will use these methods to allow sync methods inside refit interfaces.
Do you have such plans?

Current behavior:

public interface IApi
{
    [Get("/ping")]
    ApiResponse<Response> Ping(CancellationToken cancellationToken = default);
}

api.Ping() throws InvalidCastException with the following message:

Unable to cast object of type 'TaskToObservable`1[AwesomeProject.Response]' to type 'Refit.ApiResponse`1[AwesomeProject.Response]'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions