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
4
votes
1 answer

What is the correct way to post and save stream response to file using Flurl

I am trying to implement an asynchronous POST file and read the response directly to a file using Flurl. The code below works fine but not sure about the writing stream to file using c.Result.CopyTo or c.Result.CopyToAsync? What method is…
Tomas
  • 17,551
  • 43
  • 152
  • 257
4
votes
1 answer

Get response body from Flurl HttpResponseMessage

Im making some automatic surveillance for an Rest API im running and i need to retrieve the response body from the HttpResponseMessage object. Im using Flurl Http: https://flurl.dev/docs/fluent-http/ I know how to retrieve the responsebody by adding…
RatzMouze
  • 351
  • 3
  • 13
4
votes
2 answers

Handing Get/{id} vs Get/id with flurl

I'm trying to get Flurl to work and I'm stuck on how gets work when passing in an ID. [HttpGet("Get/{id}")] public IActionResult Get(int id) { // Some something and return } The above expects Get/1 So in Flurl: var result = await _baseUrl …
Michael Esteves
  • 1,445
  • 3
  • 21
  • 38
4
votes
2 answers

How to include number (hash) character # in path segment?

I have to download a file (using existing Flurl-Http endpoints [1]) whose name contains a "#" which of course has to be escaped to %23 to not conflict with uri-fragment detection. But Flurl always escapes the rest but not this character, resulting…
springy76
  • 3,706
  • 2
  • 24
  • 46
4
votes
1 answer

How to test an ASP.NET Web API running in-memory using Flurl?

The problem I try to solve: How to test client code that calls REST together with real REST server code (in an efficient way)? Goals: It would be kind of integration test, but fast and easy It would allow to detect e. g. bug where client calls…
one_mile_run
  • 3,264
  • 4
  • 26
  • 29
4
votes
1 answer

C# Flurl - Add WebRequestHandler to FlurlClient

I am working with Flurl to hit an API that requires certificate-based authentication. I have seen from this SO post that adding a certificate to a WebRequestHandler and instructing an HttpClient to use this handler is easy. However, it is not so…
Brian
  • 7,098
  • 15
  • 56
  • 73
3
votes
1 answer

Cannot Configure Flurl to use Polly PolicyHandler

I have a .NET HostedService which uses dependency injection. My client factory creates a policy handler and in DI I configure Flurl to use the factory. In debug mode I can see that clients are generated by the factory which use the…
phil
  • 1,938
  • 4
  • 23
  • 33
3
votes
1 answer

How to automatically log responses using Flurl v3.0.0

I'm using Flurl in integration testing and trying to configure a client to log responses (using Flurl.Http 3.0.0). I'm using event handlers to read the response as a string and then log it. However, if the calling code uses…
shack05
  • 33
  • 3
3
votes
1 answer

AllowHttpStatus still throw Flurl.Http.FlurlHttpException

I am using AllowHttpStatus to disable exception throwing on HTTP errors and to handle exceptions by myself. Unfortunately, I still get an exception. Flurl.Http.FlurlHttpException. Call failed with status code 500 (Internal Server Error): POST…
Tomas
  • 17,551
  • 43
  • 152
  • 257
3
votes
1 answer

IFormFileCollection is null when adding file to Flurl multi-part POST request

I am trying to upload a file using Flurl using AddFile. The resulting IFormFileCollection is null, although I am able to see the item when looking at Request.Form.Files[0] with the right content length. Creating the request: public…
jkh
  • 3,618
  • 8
  • 38
  • 66
3
votes
2 answers

Does flurl support graphQL requests?

Is it possible to use flurl to send a post request to a GraphQL API? I've tried the following, but I'm only getting errors back. var stringContent = @"query { webhooks { data { id …
3
votes
1 answer

Flurl's PostUrlEncodedAsync is ignoring JsonProperty names

I'm using Flurl (one of my favorite APIs) to now post form-data to a url. I'm quite familiar using 'JsonProperty' attributes to name the keys, and use standard casing for c#. But when I use PostUrlEncodedAsync, the normal JsonProperty code…
Phillip Davis
  • 315
  • 3
  • 15
3
votes
1 answer

Deserialized problem GetJsonAsync with Flurl

I want to parse JSON to list with Flurl. My JSON data like this. { "api": { "results": 114, "fixtures": { "195": { "fixture_id": "195", "event_timestamp": "1543759500", "event_date":…
3
votes
3 answers

How to change Content-Type in Flurl?

I have a .NET Core 2.0 WebApi application in which I have added the "Flurl.Http" (Version 2.1.0) NuGet package to my project. I am trying to use Flurl to make a simple REST API call to one of Visual Studio Team Services' (VSTS) Api…
3
votes
0 answers

Ignoring SSL Errors with Flurl in Xamarin

I would like to have Flurl and the underlying HttpClient library ignore SSL errors so I can dev locally. Specifically, I have a web api that requires a SSL certificate. I create a temporary one so I can dev locally, however Flurl and HttpClient…
Brett Cook
  • 31
  • 2
1 2
3
16 17