Skip to content

Commit

Permalink
add json test
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Sep 22, 2024
1 parent 60724ba commit ca1e106
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/Sdkgen.Client.Tests/IntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,25 @@ public async Task TestClientForm()
Assert.That(response.Form["foo"], Is.EqualTo("bar"));
}

[Test]
public async Task TestClientJson()
{
Generated.Client client = Generated.Client.Build("my_token");

var payload = new Dictionary<string, string>
{
{ "string", "bar" }
};

TestResponse response = await client.Product().Json(payload);

Assert.That(response.Headers["Authorization"], Is.EqualTo("Bearer my_token"));
Assert.That(response.Headers["Accept"], Is.EqualTo("application/json"));
Assert.That(response.Headers["User-Agent"], Is.EqualTo("SDKgen Client v1.0"));
Assert.That(response.Method, Is.EqualTo("POST"));
Assert.That(response.Json.String, Is.EqualTo("bar"));
}

[Test]
public async Task TestClientMultipart()
{
Expand Down

0 comments on commit ca1e106

Please sign in to comment.