Update test/component/Elsa.Workflows.ComponentTests/Scenarios/Activities/Http/HttpEndpointTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
a87cbe34a2
commit
e3149ea3c2
|
|
@ -133,12 +133,21 @@ public class HttpEndpointTests(App app) : AppComponentTest(app)
|
|||
};
|
||||
|
||||
var jsonContent = JsonSerializer.Serialize(largeObject);
|
||||
var content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
|
||||
|
||||
// Act
|
||||
var response = await client.PostAsync("test/json-content", content);
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
using (var content = new StringContent(jsonContent, Encoding.UTF8, "application/json"))
|
||||
{
|
||||
// Act
|
||||
var response = await client.PostAsync("test/json-content", content);
|
||||
var responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
// Verify response can be parsed back to JSON
|
||||
var parsedResponse = JsonSerializer.Deserialize<JsonElement>(responseContent);
|
||||
Assert.True(parsedResponse.TryGetProperty("Users", out var usersProperty));
|
||||
Assert.Equal(JsonValueKind.Array, usersProperty.ValueKind);
|
||||
Assert.Equal(100, usersProperty.GetArrayLength());
|
||||
}
|
||||
// Assert
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue