Skip to main content

WebRequestExtensions

A static class in Alta.Api.DataTransferModels, Alta.Api.DataTransferModels.Extensions.

Turns request bodies and response headers into readable strings for the API client's logs, hiding secrets.

Methods​

MemberWhat it is
static string SerializeContentStream(Stream contentStream)Copies a stream (rewinding it before and after when it can seek) and returns its body as text through SerializeBody.
static string SerializeToString(Stream contentStream)Returns a stream's body, or response headers one per line with authorization redacted, as a string for logging.
static string SerializeToString(HttpResponseHeaders headers)Returns a stream's body, or response headers one per line with authorization redacted, as a string for logging.
1 private and internal method
MemberWhat it is
private static string SerializeBody(Stream inputStream)Reads a stream to text and, if it's JSON, pretty-prints it with passwords, tokens and nonces masked.