Class HttpResponseDataTestExtensions
- Namespace
- XBullet.EasyTesting.AzureFunctions
- Assembly
- XBullet.EasyTesting.AzureFunctions.dll
Reads in-memory HTTP responses produced by function tests.
public static class HttpResponseDataTestExtensions
- Inheritance
-
HttpResponseDataTestExtensions
- Inherited Members
Methods
ReadBodyAsJsonAsync<T>(HttpResponseData, JsonSerializerOptions?, CancellationToken)
Deserializes the response body as JSON.
public static Task<T?> ReadBodyAsJsonAsync<T>(this HttpResponseData response, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default)
Parameters
responseHttpResponseDataThe non-null response whose body is read but left open.
optionsJsonSerializerOptionsJSON options to use, or null for new web defaults.
cancellationTokenCancellationTokenA token that cancels body reading. The default does not request cancellation.
Returns
- Task<T>
A task whose result is the deserialized value, or null when the JSON payload represents null for a nullable target.
Type Parameters
TThe target JSON model type.
ReadBodyAsStringAsync(HttpResponseData, CancellationToken)
Reads the response body as text without changing its final stream position.
public static Task<string> ReadBodyAsStringAsync(this HttpResponseData response, CancellationToken cancellationToken = default)
Parameters
responseHttpResponseDataThe non-null response whose body is read but left open.
cancellationTokenCancellationTokenA token that cancels reading. The default does not request cancellation. A successful seekable read restores the original stream position.