GetResponseStreamWithTimeout static method

Stream<List<int>> GetResponseStreamWithTimeout(
  1. IEwsHttpWebResponse response,
  2. int readTimeout
)
Gets the response stream (may be wrapped with GZip/Deflate stream to decompress content) HttpWebResponse. read timeout in milliseconds

Implementation

static Stream<List<int>> GetResponseStreamWithTimeout(
  IEwsHttpWebResponse response,
  int readTimeout,
) {
  // C# sets Stream.ReadTimeout: a read that waits longer than readTimeout
  // fails with a TimeoutException. Stream.timeout does the same between
  // chunks (the TimeoutException is delivered as a stream error).
  Stream<List<int>> responseStream = response.GetResponseStream().timeout(
    Duration(milliseconds: readTimeout),
  );

  return _WrapStream(responseStream, response.ContentEncoding);
}