Flurl

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

Github星跟蹤圖

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.

主要指標

概覽
名稱與所有者tmenier/Flurl
主編程語言C#
編程語言C# (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2014-02-16 23:43:15
推送於2025-01-01 23:14:30
最后一次提交2024-01-17 15:17:09
發布數118
最新版本名稱Flurl.Http.4.0.2 (發布於 )
第一版名稱0.1.1 (發布於 )
用户参与
星數4.3k
關注者數99
派生數393
提交數1k
已啟用問題?
問題數663
打開的問題數50
拉請求數130
打開的拉請求數6
關閉的拉請求數58
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?