ardalis / ardalis/HttpClientTestExtensions

Allow to modify the JsonSerializerOptions

Open
#41 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
107
Forks
24
PR merge metrics
No merged PRs in 30d

Description

Could we provide a way to change the default json options of JsonSerializer?
```
public static async Task GetAndDeserializeAsync(this HttpClient client, string requestUri, ITestOutputHelper output = null)
{
HttpResponseMessage obj = await client.GetAsync(requestUri, output);
obj.EnsureSuccessStatusCode();
string text = await obj.Content.ReadAsStringAsync();
output?.WriteLine("Response: " + text);
return JsonSerializer.Deserialize(text, Constants.DefaultJsonOptions);
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at GetAndDeserializeAsync and trace Constants.DefaultJsonOptions to understand where the default settings are applied. Determine how callers should provide or change JsonSerializerOptions, then verify that deserialization uses those options without breaking the existing default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.