-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
[Question/Feature request] Support for synchronous methods #992
Comments
Not likely, sync HTTP is pretty much a giant hack. Network I/O is async by definition. What is the issue with |
There are cases when you just can't use async methods. For example, when you are implementing an existing sync interface. |
This is became a necessity to call refit methods from C++/CLI code (it doesn't support async/await). I was forced to use SyncHttpClient from this repo https://github.com/pierodetomi/dotnet-webutils . |
I have to support ASP.NET MVC 4 projects, and there are places such as AuthorizeAttribute implementations that have no async support. I'm having to write different API client libraries that are async based on Refit (for all the new, shiny projects) and synchronous based on RestSharp (for all of the old stuff I have to maintain). I would love to use Refit everywhere. |
I'm closing this as won't fix. Refit may not be able to handle the edge cases where sync is required. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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:
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]'.
The text was updated successfully, but these errors were encountered: