flurl

How to resolve the error: FlurlHttpException: Call failed with status code 400 (Content-Length can't exceed 10485760 bytes (10MB).):

百般思念 提交于 2020-04-07 08:25:08
问题 When I try to upload a .wav file that is a little over two mins(20 MB) it's thrown an error such as this: Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Flurl.Http.FlurlHttpException: Call failed with status code 400 (Content-Length can't exceed 10485760 bytes (10MB).): Here is the Code: using System; using System.Net; using System.Linq; using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using Flurl; using Flurl.Http; using

How to resolve the error: FlurlHttpException: Call failed with status code 400 (Content-Length can't exceed 10485760 bytes (10MB).):

為{幸葍}努か 提交于 2020-03-25 19:11:25
问题 When I try to upload a .wav file that is a little over two mins(20 MB) it's thrown an error such as this: Unhandled Exception: System.AggregateException: One or more errors occurred. ---> Flurl.Http.FlurlHttpException: Call failed with status code 400 (Content-Length can't exceed 10485760 bytes (10MB).): Here is the Code: using System; using System.Net; using System.Linq; using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using Flurl; using Flurl.Http; using

How do I use Windows Authentication with the Flurl library?

一笑奈何 提交于 2020-03-12 19:01:48
问题 Flurl has methods for doing OAuth and Basic authentication: await url.WithBasicAuth("username", "password").GetJsonAsync(); await url.WithOAuthBearerToken("mytoken").GetJsonAsync(); but how do I do Windows authentication using the currently logged in user? The HttpClientHandler that Flurl is built on top of has a property UseDefaultCredentials but I don't know how to utilize that within Flurl. var httpClient = new HttpClient(new HttpClientHandler() { UseDefaultCredentials = true }); 回答1:

How to stop outbound HTTP connections from timing out

旧巷老猫 提交于 2020-02-24 05:56:27
问题 Backgound: I'm currently hosting an ASP.NET application in Azure with the following specs: ASP .Net Core 2.2 Using Flurl for HTTP requests Kestrel Webserver Docker (Linux - mcr.microsoft.com/dotnet/core/aspnet:2.2 runtime) Azure App Service on P2V2 tier app service plan I have a a couple of background jobs that run on the service that makes a lot of outbound HTTP calls to a 3rd party service. Issue: Under a small load (approximately 1 call per 10 seconds), all requests are completed in under

Disable AutoRedirect in FlurlClient

依然范特西╮ 提交于 2020-01-13 09:39:12
问题 I am using FlurlHttp and I want to disable AllowAutoRedirect for some API calls. I know How can I get System.Net.Http.HttpClient to not follow 302 redirects? WebRequestHandler webRequestHandler = new WebRequestHandler(); webRequestHandler.AllowAutoRedirect = false; HttpClient httpClient = new HttpClient(webRequestHandler); // Send a request using GetAsync or PostAsync Task<HttpResponseMessage> response = httpClient.GetAsync("http://www.google.com") But for Flurl I found only the way similar

Json Deserialization is not working with Flurl

六眼飞鱼酱① 提交于 2020-01-06 05:57:31
问题 I try to consume an json APIwith Flurl from a website and I'm getting parse errors or conversion errors. I'm not sure what is my problem since is the first time I deal with json files. I utilize the following online tool to create a C# object out of the json file. But when I try to get a response with Flurl I get the following errors. System.AggregateException: One or more errors occurred. ---> Flurl.Http.FlurlParsingException: Response could not be deserialized to JSON: GET ---> Newtonsoft

Parsing from json to object using FLURL

僤鯓⒐⒋嵵緔 提交于 2020-01-03 17:31:09
问题 I'm using FLURL to get a JSON response from the TVDB api. I have this class(dumbed down for now, just trying to get the seriesNames): public class Show { public string seriesName; } And I'm using FLURL like this: dynamic test = await "https://api.thetvdb.com/search/series?name=battlestar" .WithHeader("Accept", "application/json") .WithHeader("Authorization", " Bearer " + token.token) .GetAsync() .ReceiveJson<List<Show>>(); I'm guessing it doesn't map the JSON to the object correctly because

Getting back cookies from the request in Flurl.Http v2.0.1

核能气质少年 提交于 2020-01-03 11:33:52
问题 When using Flurl.Http v1.2 we had the following code: 1. var cookieJar = new CookieContainer(); 2. var url = baseUrl.AppendPathSegment("api/auth/login"); 3. var client = url.EnableCookies(); 4. ((HttpClientHandler)client.HttpMessageHandler).CookieContainer = cookieJar; 5. var result = await client.PostJsonAsync(new { UserName = userName, Password = password }); 6. var cookies = cookieJar.GetCookies(new Uri(baseUrl)); 7. _cookie = cookies[0]; After upgrading to v2.0.1 line 4 no longer compiles

Getting back cookies from the request in Flurl.Http v2.0.1

让人想犯罪 __ 提交于 2020-01-03 11:33:39
问题 When using Flurl.Http v1.2 we had the following code: 1. var cookieJar = new CookieContainer(); 2. var url = baseUrl.AppendPathSegment("api/auth/login"); 3. var client = url.EnableCookies(); 4. ((HttpClientHandler)client.HttpMessageHandler).CookieContainer = cookieJar; 5. var result = await client.PostJsonAsync(new { UserName = userName, Password = password }); 6. var cookies = cookieJar.GetCookies(new Uri(baseUrl)); 7. _cookie = cookies[0]; After upgrading to v2.0.1 line 4 no longer compiles

Getting back cookies from the request in Flurl.Http v2.0.1

落爺英雄遲暮 提交于 2020-01-03 11:33:23
问题 When using Flurl.Http v1.2 we had the following code: 1. var cookieJar = new CookieContainer(); 2. var url = baseUrl.AppendPathSegment("api/auth/login"); 3. var client = url.EnableCookies(); 4. ((HttpClientHandler)client.HttpMessageHandler).CookieContainer = cookieJar; 5. var result = await client.PostJsonAsync(new { UserName = userName, Password = password }); 6. var cookies = cookieJar.GetCookies(new Uri(baseUrl)); 7. _cookie = cookies[0]; After upgrading to v2.0.1 line 4 no longer compiles