Flurl

适用于 .NET 的流畅 URL 生成器和可测试 HTTP 客户端。「Fluent URL builder and testable HTTP client for .NET」

Github stars Tracking Chart

Flurl

build
NuGet Version
NuGet Downloads

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

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<T>();

[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.

For detailed documentation, please visit the main site.

Main metrics

Overview
Name With Ownertmenier/Flurl
Primary LanguageC#
Program languageC# (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2014-02-16 23:43:15
Pushed At2025-01-01 23:14:30
Last Commit At2024-01-17 15:17:09
Release Count118
Last Release NameFlurl.Http.4.0.2 (Posted on )
First Release Name0.1.1 (Posted on )
用户参与
Stargazers Count4.3k
Watchers Count99
Fork Count393
Commits Count1k
Has Issues Enabled
Issues Count663
Issue Open Count50
Pull Requests Count130
Pull Requests Open Count6
Pull Requests Close Count58
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private