示例#1
0
        public async Task ReturnTheFunction(TransferProtocolReceiver protocol, TransferProtocolReceiverVefify protocolVerify)
        {
            protocolVerify.SetupRequest(_anyObject);
            var functionName = await protocol.GetRequestFunctionAsync();

            var expectedFunctionName = _uri.PathAndQuery.Replace("/", string.Empty);

            functionName.Should().Be(expectedFunctionName);
        }
示例#2
0
        internal async Task HandleIncomingStream()
        {
            var requestBytes = await _protocolReceiver.ReadRequestAsync();

            var functionName = await _protocolReceiver.GetRequestFunctionAsync();

            //TODO: replace with right server actions (below for sample only)
            //Console.WriteLine($"Function to call: {functionName}");
            //Console.WriteLine($"req message: {Encoding.ASCII.GetString(requestBytes)}");
            byte[] responseBytes = Encoding.ASCII.GetBytes("hello world");
            var    headers       = new Dictionary <string, string>
            {
                { ":status", "200" },
                { "info", "pass" }
            };
            await _protocolReceiver.SendResponseAsync(headers, responseBytes);
        }