2019-04-28 10:51:47 -05:00
2019-02-24 19:42:50 +03:00
2019-04-28 10:51:47 -05:00
2016-04-06 00:40:58 +03:00
2017-07-17 11:25:42 +03:00
2018-06-13 10:21:07 -05:00
2017-06-05 22:32:36 +03:00
2019-04-27 09:59:44 -05:00

Flurl

Build status Flurl Flurl.Http

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(200, "OK");

        // act
        await sut.CreatePersonAsync("Claire", "Underwood");
        
        // 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.

Description
No description provided
Readme 5.6 MiB
Languages
C# 99.5%
Shell 0.3%
Batchfile 0.2%