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?
已存档?
是复刻?
已锁定?
是镜像?
是私有?