public async ValueTask<StorageResponse> SendRequest<TRequest>(TRequest request)
            where TRequest : IStorageRequest
        {
            if (!_client.IsConnected)
            {
                _pipe = await SocketPipe.ConnectAsync(_host, _port).ConfigureAwait(false);
                _pipe.Log = Log;
                _client = new PipeHttpClient(_pipe);
            }
            request.Client = this;

            StorageResponse response = await _client.SendRequest<TRequest, StorageResponse>(request).ConfigureAwait(false);
            if (request.ConsumeBody) await ConsumeResponseBody(response.Body);
            return response;
        }
Exemple #2
0
        public async ValueTask <StorageResponse> SendRequest <TRequest>(TRequest request)
            where TRequest : IStorageRequest
        {
            if (!_socket.IsConnected)
            {
                _socket = await SocketClient.ConnectAsync(_host, _port).ConfigureAwait(false);

                _socket.Log = Log;
            }
            request.Client = this;

            StorageResponse response = await _socket.SendRequest <TRequest, StorageResponse>(request).ConfigureAwait(false);

            if (request.ConsumeBody)
            {
                await ConsumeResponseBody(response.Body);
            }
            return(response);
        }