Questions tagged [flurl]

Flurl is a fluent URL builder and wrist-friendly HTTP client library for .NET.

Flurl is a modern, fluent, asynchronous, testable, portable, buzzword-laden URL builder and HTTP client library for .NET.

With a discoverable API, extensibility at every turn, and a nifty set of testing features, Flurl is intended to make building and calling URLs easy and downright fun.

Flurl is available on NuGet in two flavors:

  • Flurl.Http includes all features.
  • Flurl for just the URL builder functionality without the HTTP features.
255 questions
3
votes
5 answers

How to do XML POST with FlUrl

FlUrl does a great job in dealing with Json/UrlEncoded requests. However, the documentation doesn't really point out how to handle other request types such as text/xml. What's the best way to do an XML POST using FlUrl? This (accessing underlying…
Mrchief
  • 75,126
  • 20
  • 142
  • 189
2
votes
1 answer

Polly Retry : System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Flurl.Http.Content.FileContent'

I'm using flurl and polly as part of my code to post asynchronously - I'm having an issue with the retry policy and the file content getting disposed, on a retry the FileContent option has been disposed. I will get the following…
2
votes
1 answer

Am I safe from thread pool starvation/socket issues if I use Flurl in a service thats registered as Transient?

Let's say I have a simple service that's registered as a Transient in Startup, and I use Flurl like so: public async Task DoStuff() { string url = "some valid Url"; await url .AppendPathSegment("notifications") …
broke
  • 8,032
  • 16
  • 54
  • 83
2
votes
1 answer

Observable's LastAsync() deadlocks in console app

When using IObservable.LastAsync() to force my console app to wait on the result of an API call using Flurl, that API call is never made and the main thread deadlocks and never returns from LastAsync(). My goals are: Since this is a console app, I…
void.pointer
  • 24,859
  • 31
  • 132
  • 243
2
votes
2 answers

How do I support a backward breaking change to JSON payload in Flurl / Json.net?

An API I depend on (that I have no control over) previously took a JSON structure like so: { "values": "one, two, three" } The API made a backward-breaking change to this payload, and converted the comma-separated values in a string to a JSON…
void.pointer
  • 24,859
  • 31
  • 132
  • 243
2
votes
1 answer

Using Flurl's OnError to check for custom response headers in ASP.NET Core Web API

I am developing a sort of middleware API, which is meant to connect to various systems. I am using the Flurl library to make requests to the individual systems. One of these systems sometimes returns a custom header containing an error message,…
thebugsdontwork
  • 401
  • 3
  • 17
2
votes
1 answer

Problems catching exception from http flurl client

I have a rest api with .net5, which has a global exception filter, and returns an ErrorMessage object in case of exceptions. I call the api from a WinForms .net framework 4.8 application and the badrequests from the server, from the client side I…
2
votes
0 answers

Nested Query String Encoder/Decoder c#

Brief I'm trying to call some API endpoints who use nested query strings in the GET calls Issue Trying not to reinvent the wheel, I'm looking for a library that is able to convert a nested object into query string parameters Example Given the…
ioan
  • 751
  • 1
  • 9
  • 26
2
votes
2 answers

Nested values with POST using Flurl

So I'm a Ruby dev messing with C# and trying to figure out how to use Flurl with my endpoint. Here's the JSON I can pass successfully with Ruby. { type: "workorder.generated", data: [{ id: order.id, type: "orders" …
yeowoh
  • 143
  • 1
  • 9
2
votes
1 answer

How to simulate longer response time (not timeout) using HttpTest (flurl)

I want to configure HttpTest to simulate slow response tests; like wait X seconds before responding with configured RespondWith* response. Any suggestions?
reaz
  • 23
  • 3
2
votes
1 answer

How to use Flurl with instance of HttpClient

Let's say I have an instance of HttpClient which is already configured. And now I want to use it for Flurl requests. I'd like to do something like this: var poco = await httpClient.GetJsonAsync(); Is this possible?
Prolog
  • 2,698
  • 1
  • 18
  • 31
2
votes
1 answer

How to verify request body content in Flurl Http in unit tests?

I'm using Flurl Http to make http requests. In the unit tests, I'm trying to verify that the expected content was passed to the sender. I'm trying it like: httpTest.ShouldHaveCalled(url) .WithVerb(HttpMethod.Post) …
kovac
  • 4,945
  • 9
  • 47
  • 90
2
votes
1 answer

binding flurl client to a specific network interface

with restsharp it's possible to bind requests to a specific network interface. is it even possible with flurl so that I can tell my requests to use a specific local interface to use?
HuseyinUslu
  • 4,094
  • 5
  • 33
  • 50
2
votes
1 answer

Is there autogenerated code for Flurl using swagger.json?

There are some client generators (eg. Postman, Swagger-codegen https://editor.swagger.io/) that uses libraries such as Restsharp to automatically generate classes for a given swagger.json from an API. Is there any client generator that does that…
staticdev
  • 2,950
  • 8
  • 42
  • 66
2
votes
1 answer

F# internal visibility changes Record constructor behavior

I'm caling an API using Flurl. //# models.fs module models = type Ticker = { Ask :decimal; Bid :decimal; Last: decimal; High :decimal; Timestamp :int; } //# Client.fs namespace MyLibrary // ... some code …
Alex 75
  • 2,798
  • 1
  • 31
  • 48