1

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.

Community
  • 1
  • 1
flq
  • 22,247
  • 8
  • 55
  • 77

1 Answers1

2

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
}
Community
  • 1
  • 1
mythz
  • 141,670
  • 29
  • 246
  • 390