loresoft / FluentRest

Lightweight fluent wrapper over HttpClient to make REST calls easier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to post json

gatspy opened this issue · comments

i like this lib,when use json string to post , I want to how to do?

To post JSON, use the Content method. You can change the serializer by implementing the IContentSerializer interface. The default implementation is JsonContentSerializer

var user = UserData.Create();
var client = CreateClient();

var result = await client.PostAsync<EchoResult>(b => b
    .AppendPath("post")
    .QueryString("page", 10)
    .Content(user)
);