Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tmenier/flurl
Fluent URL builder and testable HTTP client for .NET
https://github.com/tmenier/flurl
c-sharp dotnet http rest-client url-builder
Last synced: 25 days ago
JSON representation
Fluent URL builder and testable HTTP client for .NET
- Host: GitHub
- URL: https://github.com/tmenier/flurl
- Owner: tmenier
- License: mit
- Created: 2014-02-16T23:43:15.000Z (over 10 years ago)
- Default Branch: dev
- Last Pushed: 2024-09-11T22:01:34.000Z (about 2 months ago)
- Last Synced: 2024-10-15T09:04:17.588Z (25 days ago)
- Topics: c-sharp, dotnet, http, rest-client, url-builder
- Language: C#
- Homepage: https://flurl.dev
- Size: 5.43 MB
- Stars: 4,193
- Watchers: 101
- Forks: 388
- Open Issues: 53
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Flurl
[![build](https://github.com/tmenier/Flurl/actions/workflows/ci.yml/badge.svg)](https://github.com/tmenier/Flurl/actions/workflows/ci.yml)
[![NuGet Version](http://img.shields.io/nuget/v/Flurl.Http.svg?style=flat)](https://www.nuget.org/packages/Flurl.Http/)
[![NuGet Downloads](https://img.shields.io/nuget/dt/Flurl.Http.svg)](https://www.nuget.org/packages/Flurl.Http/)Flurl is a modern, fluent, asynchronous, testable, portable, buzzword-laden URL builder and HTTP client library.
```cs
var result = await "https://api.mysite.com"
.AppendPathSegment("person")
.SetQueryParams(new { api_key = "xyz" })
.WithOAuthBearerToken("my_oauth_token")
.PostJsonAsync(new { first_name = firstName, last_name = lastName })
.ReceiveJson();[Test]
public void Can_Create_Person() {
// fake & record all http calls in the test subject
using var httpTest = new HttpTest();// arrange
httpTest.RespondWith("OK", 200);// act
await sut.CreatePersonAsync("Frank", "Reynolds");
// assert
httpTest.ShouldHaveCalled("http://api.mysite.com/*")
.WithVerb(HttpMethod.Post)
.WithContentType("application/json");
}
```Get it on NuGet:
`PM> Install-Package Flurl.Http`
Or get just the stand-alone URL builder without the HTTP features:
`PM> Install-Package Flurl`
For updates and announcements, [follow @FlurlHttp on Twitter](https://twitter.com/intent/user?screen_name=FlurlHttp).
For detailed documentation, please visit the [main site](https://flurl.dev).