Question

While I have already learned how I can easily write to the response stream, I was wondering whether in the context of a ServiceStack client (e.g. ServiceClientBase) I can gain access to the server's response stream.

Before I start accessing the HttpWebResponse object I wanted to double-check that I do not reinvent the wheel.

Was it helpful?

Solution

See this earlier answer for examples of how to access the underlying raw response types.

Also the C# ServiceClient wiki is the authoritative documentation on ServiceStack's built in C#/.NET service clients. It includes a section on different ways of accessing the underlying raw response, including via the Response stream:

using (Stream responseStream = client.Get<Stream>("/poco/World")) {
    var dto = responseStream.ReadFully().FromUtf8Bytes().FromJson<PocoResponse>();
    dto.Result //Hello, World
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top