Practice · 1 of 4
Status Codes to Typed Outcomes
CHALLENGE
Difficulty: intermediate+25 XP
Implement GetOutcomeAsync over an injected HttpClient (stubbed by the harness): return "data:<body>" for 2xx, "notfound" for 404, "servererror" for any 5xx, "forbidden" for 403. Anything else 4xx -> "error:<code>".
``csharp
static Task<string> GetOutcomeAsync(HttpClient http, string path, CancellationToken ct = default);
``
Press Submit to check your solution.
Back to lesson: Practice: HTTP Practice: Handlers, Outcomes, Retries