refit

Azure web api call slow on phone but works well on android emulator

僤鯓⒐⒋嵵緔 提交于 2019-12-11 05:15:39
问题 I am trying to make a call to my web api using Refit in a Xamarin Forms app and it seems to work well in the emulator (2 - 5 secs) but crashes most times on a real android phone or takes quite long to return on rare occasions. I am using a basic 5 DTU SQL database on Azure. Could this be the reason I have tried to make 2 calls from the device and the spike in the chart above is a result of it. The first query takes a bit of time and once it returns (I managed to get a reply this time) I make

How to set timeout in Refit library

↘锁芯ラ 提交于 2019-12-06 03:36:04
问题 I am using Refit library in my Xamarin App, I want to set 10 seconds timeout for the request. Is there any way to do this in refit? Interface: interface IDevice { [Get("/app/device/{id}")] Task<Device> GetDevice(string id, [Header("Authorization")] string authorization); } Invoking the API var device = RestService.For<IDevice>("http://localhost"); var dev = await device.GetDevice("15e2a691-06df-4741-b26e-87e1eecc6bd7", "Bearer OAUTH_TOKEN"); 回答1: The accepted answer is the correct way to

How to set timeout in Refit library

一世执手 提交于 2019-12-04 08:21:19
I am using Refit library in my Xamarin App, I want to set 10 seconds timeout for the request. Is there any way to do this in refit? Interface: interface IDevice { [Get("/app/device/{id}")] Task<Device> GetDevice(string id, [Header("Authorization")] string authorization); } Invoking the API var device = RestService.For<IDevice>("http://localhost"); var dev = await device.GetDevice("15e2a691-06df-4741-b26e-87e1eecc6bd7", "Bearer OAUTH_TOKEN"); The accepted answer is the correct way to enforce a timeout for a single request, but if you want to have a single consistent timeout value for all

How to disable urlencoding get-params in Refit?

懵懂的女人 提交于 2019-11-28 09:29:31
问题 I use Refit for RestAPI. I need create query strings same api/item?c[]=14&c[]=74 In refit interface I created method [Get("/item")] Task<TendersResponse> GetTenders([AliasAs("c")]List<string> categories=null); And create CustomParameterFormatter string query = string.Join("&c[]=", values); CustomParameterFormatter generated string 14&c[]=74 But Refit encoded parameter and generated url api/item?c%5B%5D=14%26c%5B%5D%3D74 How disable this feature? 回答1: First of all was your api server able to